public ActionResult EditEquipment(int EquipId) { if (IsStillHead()) { return RedirectToAction("Error"); } var x = (from y in con.Equipments where y.EquipmentId == EquipId select y).FirstOrDefault(); itmmAdminEquipment model = new itmmAdminEquipment(); model.make = x.Make; model.description = x.Description; model.location = x.Location; model.serial = x.SerialNumber; model.status = x.Status; model.life = x.LifeExpectancy; return View(model); }
public ActionResult EditEquipment(itmmAdminEquipment model, int EquipId) { var x = (from y in con.Equipments where y.EquipmentId == EquipId select y).FirstOrDefault(); x.Make = model.make; x.Description = model.description; x.Location= model.location; x.SerialNumber = model.serial; x.Status = model.status; x.LifeExpectancy = model.life; con.SaveChanges(); return RedirectToAction("Equipment", "Head"); }
public ActionResult Equipment(itmmAdminEquipment model) { Equipment e = new Equipment(); e.Make = model.make; e.Description = model.description; e.Location = model.location; e.SerialNumber = model.serial; e.Barcode = model.barcode; e.Status = model.status; e.LifeExpectancy = model.life; e.DateReceived = DateTime.Now; con.AddToEquipments(e); //Laboratory_Equipment Laboratory_Equipment le = new Laboratory_Equipment(); le.EquipmentId = e.EquipmentId; le.LaboratoryId = getLabId(); con.AddToLaboratory_Equipment(le); con.SaveChanges(); return RedirectToAction("Equipment", "Head"); }