コード例 #1
0
        public string InsertStudentDiscount(InsertStudentDiscount obj)
        {
            string returnResult = (dynamic)null;

            try
            {
                var studentsList = _studentsRepo.GetAll().ToList();
                var query        = (from _student in studentsList
                                    where _student.RegistrationNo == obj.StudentDiscounts.RegistrationNo
                                    select _student).SingleOrDefault();
                if (obj != null)
                {
                    //[Note: insert 'states' table]
                    if (obj.StudentDiscounts != null)
                    {
                        var StudentDiscounts = new InsertStudentDiscount_StudentDiscounts()
                        {
                            StudentId     = query.Id,
                            FeeTypeId     = obj.StudentDiscounts.FeeTypeId,
                            DiscountAmout = obj.StudentDiscounts.DiscountAmout
                        };
                        _StudentDiscountsRepo.Insert(StudentDiscounts);
                        returnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                returnResult = "ERROR102:ClassesServ/InsertClassessList - " + ex.Message;
            }
            return(returnResult);
        }
コード例 #2
0
 public async Task <IActionResult> InsertStudentDiscount(IndexStudentDiscountsListVM obj)
 {
     try
     {
         if (obj.StudentDiscounts != null)
         {
             var StudentDiscounts = new InsertStudentDiscount_StudentDiscounts()
             {
                 StudentId      = obj.StudentDiscounts.StudentId,
                 RegistrationNo = obj.StudentDiscounts.RegistrationNo,
                 StudentName    = obj.StudentDiscounts.StudentName,
                 FeeTypeId      = obj.StudentDiscounts.FeeTypeId,
                 FeeType        = obj.StudentDiscounts.FeeType,
                 DiscountAmout  = obj.StudentDiscounts.DiscountAmout
             };
             var model = new InsertStudentDiscount()
             {
                 StudentDiscounts = StudentDiscounts
             };
             await Task.Run(() => _StudentDiscountsServ.InsertStudentDiscount(model));
         }
     }
     catch (Exception)
     {
         return(BadRequest());
     }
     return(RedirectToAction("StudentDiscountsList"));
 }