public ActionResult Create(CreateLostPetBM bind) { var validImageTypes = new string[] { "image/gif", "image/jpeg", "image/pjpeg", "image/jpg", "image/png" }; //if (bind.Thumbnail == null || bind.Thumbnail.ContentLength == 0) //{ // ModelState.AddModelError("Thumbnail", "This field is required"); //} if (bind.Thumbnail != null && (!validImageTypes.Contains(bind.Thumbnail.ContentType))) { ModelState.AddModelError("Thumbnail", "Please choose either a GIF, JPG or PNG image."); } if (this.ModelState.IsValid) { string username = User.Identity.Name; this.service.CreateNewLostPet(bind, username); return(this.RedirectToAction("Index")); } CreateLostPetVM vm = new CreateLostPetVM(); return(View(vm)); }
public ActionResult Create() { CreateLostPetVM vm = new CreateLostPetVM(); return(View(vm)); }