public IActionResult Save(ItemCreationViewModel icvm) { if (ModelState.IsValid) { if (icvm.ImageFile.Length <= 0 || !icvm.ImageFile.ContentType.Contains("image")) { ModelState.AddModelError("ImageFile", "Selected file is not an image."); return(View("CreateItem", icvm)); } Item tempitem = ItemToItemVM.ToItem(icvm); _ir.Create(tempitem); return(RedirectToAction("AllItems", "Item")); } return(View("CreateItem", icvm)); }