public ActionResult Edit(int id) { PrepareViewBag(); Size pt = _SizeService.Find(id); bool SizeExists = _SizeService.CheckSizeExists(id); if (SizeExists) { TempData["CSEXC"] += "Product is already created."; } if (!SizeExists) { ViewBag.Mode = "Edit"; } if (pt == null) { return(HttpNotFound()); } return(View("Create", pt)); }