Exemplo n.º 1
0
 public int AddStudentFeeDiscount(StudentFeeDiscount studentFeeDiscount)
 {
     try
     {
         _dbContext.StudentFeeDiscount.Add(studentFeeDiscount);
         return(_dbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public IActionResult DeleteStudentFeeDiscount([FromBody] StudentFeeDiscount stuFeeDiscount)
 {
     try
     {
         var result = _studentBusiness.DeleteStudentFeeDiscount(stuFeeDiscount);
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Exemplo n.º 3
0
 public int DeleteStudentFeeDiscount(StudentFeeDiscount studentFeeDiscount)
 {
     try
     {
         _dbContext.StudentFeeDiscount.Add(studentFeeDiscount);
         _dbContext.Entry(studentFeeDiscount).State = EntityState.Modified;
         return(_dbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public IEnumerable <StudentFeeDiscount> EditStudentFeeDiscount(StudentFeeDiscount stuFeeDiscount)
        {
            try
            {
                var editObj = _studentDataAccess.StudentFeeDiscountById(stuFeeDiscount.Id);
                if (editObj != null)
                {
                    editObj.StudentTypeId = stuFeeDiscount.StudentTypeId;
                    editObj.FeeTypeId     = stuFeeDiscount.FeeTypeId;
                    editObj.Amount        = stuFeeDiscount.Amount;
                    editObj.StatusId      = stuFeeDiscount.StatusId;
                    editObj.ModifiedBy    = _username;
                    editObj.ModifiedDate  = DateTime.Now;

                    var editresult = _studentDataAccess.EditStudentFeeDiscount(editObj);

                    if (editresult > 0)
                    {
                        var result      = _studentDataAccess.StudentFeeDiscount(false);
                        var returnValue = result.Select(x => new StudentFeeDiscount
                        {
                            Id            = x.Id,
                            StudentType   = x.StudentType.Name,
                            StudentTypeId = x.StudentTypeId,
                            FeeType       = x.FeeType.Name,
                            FeeTypeId     = x.FeeTypeId,
                            Amount        = x.Amount,
                            Status        = x.Status.Name,
                            StatusId      = x.StatusId
                        }).ToList();
                        return(returnValue);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public IEnumerable <StudentFeeDiscount> DeleteStudentFeeDiscount(StudentFeeDiscount stuFeeDiscount)
        {
            try
            {
                var deleteObj = _studentDataAccess.StudentFeeDiscountById(stuFeeDiscount.Id);
                if (deleteObj != null)
                {
                    deleteObj.StatusId     = Guid.Parse(Constants.INACTIVESTATUS);
                    deleteObj.ModifiedBy   = _username;
                    deleteObj.ModifiedDate = DateTime.Now;

                    var deleteresult = _studentDataAccess.DeleteStudentFeeDiscount(deleteObj);

                    if (deleteresult > 0)
                    {
                        var result      = _studentDataAccess.StudentFeeDiscount(false);
                        var returnValue = result.Select(x => new StudentFeeDiscount
                        {
                            Id            = x.Id,
                            StudentType   = x.StudentType.Name,
                            StudentTypeId = x.StudentTypeId,
                            FeeType       = x.FeeType.Name,
                            FeeTypeId     = x.FeeTypeId,
                            Amount        = x.Amount,
                            Status        = x.Status.Name,
                            StatusId      = x.StatusId
                        }).ToList();
                        return(returnValue);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
 public IEnumerable <StudentFeeDiscount> AddStudentFeeDiscount(StudentFeeDiscount stuFeeDiscount)
 {
     try
     {
         var addObj = new DbModel.StudentFeeDiscount
         {
             Id            = Guid.NewGuid(),
             StudentTypeId = stuFeeDiscount.StudentTypeId,
             FeeTypeId     = stuFeeDiscount.FeeTypeId,
             Amount        = stuFeeDiscount.Amount,
             StatusId      = stuFeeDiscount.StatusId,
             CreatedBy     = _username,
             CreatedDate   = DateTime.Now
         };
         var addresult = _studentDataAccess.AddStudentFeeDiscount(addObj);
         if (addresult > 0)
         {
             var result      = _studentDataAccess.StudentFeeDiscount(true);
             var returnValue = result.Select(x => new StudentFeeDiscount
             {
                 Id            = x.Id,
                 StudentType   = x.StudentType.Name,
                 StudentTypeId = x.StudentType.Id,
                 FeeType       = x.FeeType.Name,
                 FeeTypeId     = x.FeeType.Id,
                 Amount        = x.Amount,
                 Status        = x.Status.Name,
                 StatusId      = x.StatusId
             }).ToList();
             return(returnValue);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }