CameraCar.Controllers.HomeController.photo C# (CSharp) Method

photo() public method

public photo ( string id ) : System.Web.Mvc.ActionResult
id string
return System.Web.Mvc.ActionResult
        public ActionResult photo(string id)
        {
            if (Regex.IsMatch(id ?? "", @"^photo\d{3}$") == false)
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            var saveDir = Server.MapPath("~/App_Data");
            var imagPath = System.IO.Path.Combine(saveDir, id + ".jpg");

            return File(imagPath, "image/jpeg");
        }