Пример #1
0
        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(itmmIncome a, int IncomeId)
        {
            var x = (from y in con.Incomes
                     where y.IncomeId == IncomeId
                     select y).FirstOrDefault();

            x.StudentInfo.FirstName     = a.FirstName;
            x.StudentInfo.FamiliyName   = a.FamilyName;
            x.StudentInfo.StudentId     = a.IdNumber.ToString();
            x.StudentInfo.CourseAndYear = a.Course;
            x.cost         = a.Cost;
            x.Transactionn = a.Transaction;
            con.SaveChanges();

            return(RedirectToAction("Income"));
        }
        public ActionResult EditIncome(int IncomeId)
        {
            var x = (from y in con.Incomes
                     where y.IncomeId == IncomeId
                     select y).FirstOrDefault();

            itmmIncome a = new itmmIncome();

            a.FamilyName  = x.StudentInfo.FamiliyName;
            a.FirstName   = x.StudentInfo.FirstName;
            a.IdNumber    = Convert.ToInt32(x.StudentInfo.StudentId);
            a.Course      = x.StudentInfo.CourseAndYear;
            a.Cost        = Convert.ToInt32(x.cost);
            a.Transaction = x.Transactionn;
            return(View(a));
        }