// GET: /Employee/Edit/Id /// <param name="Id">Employee's Id parameter.</param> /// <returns>Returns "Edit" view to edit an employee.</returns> public ActionResult Edit(int?Id) { if (Id == null) { return(RedirectToAction("Create")); } else { Employee employee = db.Employees.SingleOrDefault(x => x.Id == Id); if (employee != null) { Image image = db.Images.SingleOrDefault(x => x.employee.Id == employee.Id); if (image != null) { ViewBag.ImageName = "../../Content/images/Employee-Images/" + employee.Id.ToString() + "/" + image.Name; } ViewBag.ActionTitle = Text_en.Read("employee.edit.heading"); return(View(employee)); } else { return(RedirectToAction("Index", "Error")); } } }
// GET: /Employee/Create /// <returns> /// Returns "Edit" view for employee creation. /// </returns> public ActionResult Create() { ViewBag.ActionTitle = Text_en.Read("employee.create.heading"); return(View("Edit")); }