Beispiel #1
0
 public async Task <IActionResult> InsertFeeStructure(IndexFeeStructuresListVM obj)
 {
     try
     {
         if (obj.FeeStructures != null)
         {
             var FeeStructures = new InsertFeeStructure_FeeStructures()
             {
                 ClassId      = obj.FeeStructures.ClassId,
                 FeeTypeId    = obj.FeeStructures.FeeTypeId,
                 Amount       = obj.FeeStructures.Amount,
                 YearlyTermNo = obj.FeeStructures.YearlyTermNo,
                 StartYear    = obj.FeeStructures.StartYear,
                 EndYear      = obj.FeeStructures.EndYear,
                 IsActive     = obj.FeeStructures.IsActive
             };
             var model = new InsertFeeStructure()
             {
                 FeeStructures = FeeStructures
             };
             await Task.Run(() => _FeeStructuresServ.InsertFeeStructure(model));
         }
     }
     catch (Exception)
     {
         return(BadRequest());
     }
     return(RedirectToAction("FeeStructuresList"));
 }
        public string InsertFeeStructure(InsertFeeStructure obj)
        {
            string returnResult = (dynamic)null;

            try
            {
                if (obj != null)
                {
                    //[Note: insert 'states' table]
                    if (obj.FeeStructures != null)
                    {
                        DateTime sDate = DateTime.ParseExact(obj.FeeStructures.StartYear, "yyyy", null);
                        DateTime eDate = DateTime.ParseExact(obj.FeeStructures.EndYear, "yyyy", null);
                        //var FeeStructures = new InsertFeeStructure_FeeStructures()
                        var FeeStructures = new FeeStructures()
                        {
                            ClassId      = obj.FeeStructures.ClassId,
                            FeeTypeId    = obj.FeeStructures.FeeTypeId,
                            Amount       = obj.FeeStructures.Amount,
                            YearlyTermNo = obj.FeeStructures.YearlyTermNo,
                            StartingYear = sDate,
                            EndingYear   = eDate,
                            IsActive     = obj.FeeStructures.IsActive
                        };
                        _FeeStructuresRepo.Insert(FeeStructures);
                        returnResult = "Saved";
                    }
                }
            }
            catch (Exception ex)
            {
                returnResult = "ERROR102:ClassesServ/InsertClassessList - " + ex.Message;
            }
            return(returnResult);
        }