public ActionResult DeleteConfirmed(short id) { try { HR_Location hr_location = db.HR_Location.Find(id); db.HR_Location.Remove(hr_location); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception) { throw; } }
public ActionResult Create([Bind(Include = "LocID,LocationName")] HR_Location hr_location) { try { // hr_location.Status = (bool)ValueProvider.GetValue("Status").ConvertTo(typeof(bool)); if (ModelState.IsValid) { db.HR_Location.Add(hr_location); db.SaveChanges(); return(RedirectToAction("Index")); } // ViewBag.CityID = new SelectList(db.HR_City, "CitID", "CityName", hr_location.CityID); return(View(hr_location)); } catch (Exception) { throw; } }
// GET: /HumanResource/Location/Details/5 public ActionResult Details(short?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HR_Location hr_location = db.HR_Location.Find(id); if (hr_location == null) { return(HttpNotFound()); } return(View(hr_location)); } catch (Exception) { throw; } }
public ActionResult Edit([Bind(Include = "LocID,LocationName,OLocationID,Status")] HR_Location hr_location) { try { // hr_location.Status = (bool)ValueProvider.GetValue("Status").ConvertTo(typeof(bool)); if (ModelState.IsValid) { db.Entry(hr_location).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Location), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)hr_location.LocID); return(RedirectToAction("Index")); } return(View(hr_location)); } catch (Exception) { throw; } }
// GET: /HumanResource/Location/Edit/5 public ActionResult Edit(short?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewBag.Station = db.HR_Location.First(aa => aa.LocID == id).LocationName; HR_Location hr_location = db.HR_Location.Find(id); if (hr_location == null) { return(HttpNotFound()); } return(View(hr_location)); } catch (Exception) { throw; } }