public ActionResult Liability(itmmLiability a) { StudentInfo c = new StudentInfo(); c.FirstName = "autogen"; c.FamiliyName = "autogen"; c.StudentId = a.IdNumber.ToString(); c.CourseAndYear = "autogen"; con.AddToStudentInfoes(c); var labid = getLabId(); Liability b = new Liability(); b.StudenInfotId = a.IdNumber;//Convert.ToInt32(a.IdNumber); // b.Equipment = a.Equipment; b.Equipment = (from y in con.Equipments where y.Barcode == a.Barcode select y.Make).FirstOrDefault(); b.Fine = a.Fine; b.Status = a.Status; b.LaboratoryId = labid; b.Barcode = a.Barcode; // b.StudenInfotId = c.StudentInfoId; con.AddToLiabilities(b); var d = (from y in con.Equipments where y.Barcode == a.Barcode select y).FirstOrDefault(); d.Status = "Liability"; con.SaveChanges(); return RedirectToAction("Liability"); }
public ActionResult EditLiability(int LiabilityId) { var c = (from y in con.Liabilities where y.LiabilityId == LiabilityId select y).FirstOrDefault(); //var b = (from y in con.Liabilities // where y.LiabilityId == LiabilityId // select y.StudentInfo).FirstOrDefault(); itmmLiability a = new itmmLiability(); //a.FamilyName = b.FamiliyName; //a.FirstName=b.FirstName; //a.IdNumber=b.IdNumber; //a.Course=b.CourseAndYear; a.IdNumber = c.StudenInfotId.ToString(); a.Equipment = c.Equipment; a.Fine = c.Fine; a.Status = c.Status; return View(a); }
public ActionResult EditLiability(int LiabilityId, itmmLiability a, string status) { var c = (from y in con.Liabilities where y.LiabilityId == LiabilityId select y).FirstOrDefault(); //var b = (from y in con.Liabilities // where y.LiabilityId == LiabilityId // select y.StudentInfo).FirstOrDefault(); //b.FamiliyName = a.FamilyName; //b.FirstName = a.FirstName; //b.IdNumber = a.IdNumber; //b.CourseAndYear = a.Course; c.StudenInfotId = a.IdNumber;//Convert.ToInt32(a.IdNumber); c.Equipment = a.Equipment; c.Barcode = a.Barcode; c.Fine = a.Fine; c.Status = status; con.SaveChanges(); return RedirectToAction("Liability"); }
public ActionResult Liability(itmmLiability a) { StudentInfo c = new StudentInfo(); c.FirstName = "autogen"; c.FamiliyName = "autogen"; c.StudentId = a.IdNumber.ToString(); c.CourseAndYear = "autogen"; con.AddToStudentInfoes(c); var labid = getLabId(); Liability b = new Liability(); b.StudenInfotId = Convert.ToInt32(a.IdNumber); b.Equipment = a.Equipment; b.Fine = a.Fine; b.Status = a.Status; b.LaboratoryId = labid; b.StudenInfotId = c.StudentInfoId; con.AddToLiabilities(b); con.SaveChanges(); return RedirectToAction("Liability"); }