public ActionResult EditIncome(itmmIncome a, int IncomeId) { //var x = (from y in con.Incomes // where y.IncomeId == IncomeId // select y).FirstOrDefault(); var x = (from y in con.StudentInfoes where y.IncomeId == IncomeId select y).FirstOrDefault(); x.FirstName = a.FirstName; x.FamiliyName = a.FamilyName; x.StudentId = a.IdNumber.ToString(); x.CourseAndYear = a.Course; x.Income.cost = a.Cost; x.Income.Transactionn = a.Transaction; con.SaveChanges(); return RedirectToAction("Income"); }
public ActionResult Income(itmmIncome a) { itmm.Models.Income b = new itmm.Models.Income(); b.Transactionn = a.Transaction; b.cost = a.Cost; b.LaboratoryId = getLabId(); b.DateCreated = DateTime.Now; StudentInfo c = new StudentInfo(); c.FirstName = a.FirstName; c.FamiliyName = a.FamilyName; c.StudentId = a.IdNumber.ToString(); c.CourseAndYear = a.Course; c.IncomeId = b.IncomeId; b.StudentInfoId = c.StudentInfoId; con.AddToIncomes(b); con.AddToStudentInfoes(c); con.SaveChanges(); return RedirectToAction("Income"); }
public ActionResult EditIncome(int IncomeId) { //var x = (from y in con.Incomes // where y.IncomeId == IncomeId // select y).FirstOrDefault(); var x = (from y in con.StudentInfoes where y.IncomeId == IncomeId select y).FirstOrDefault(); itmmIncome a = new itmmIncome(); a.FamilyName = x.FamiliyName; a.FirstName = x.FirstName; a.IdNumber = Convert.ToInt32(x.StudentId); a.Course = x.CourseAndYear; a.Cost = Convert.ToInt32(x.Income.cost); a.Transaction = x.Income.Transactionn; return View(a); }