public async Task <IActionResult> UpdateSemesterFeeMapping(SemesterFeeMappingDtoForEdit model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _response = await _repo.UpdateSemesterFeeMapping(model); return(Ok(_response)); }
public async Task <ServiceResponse <object> > UpdateSemesterFeeMapping(SemesterFeeMappingDtoForEdit model) { var ObjToUpdate = _context.SemesterFeeMappings.FirstOrDefault(s => s.Id.Equals(model.Id)); if (ObjToUpdate != null) { ObjToUpdate.SemesterId = Convert.ToInt32(model.SemesterId); ObjToUpdate.ClassId = Convert.ToInt32(model.ClassId); ObjToUpdate.StudentId = Convert.ToInt32(model.StudentId); ObjToUpdate.DiscountInPercentage = Convert.ToInt32(model.DiscountInPercentage); ObjToUpdate.FeeAfterDiscount = Convert.ToDouble(model.FeeAfterDiscount); ObjToUpdate.Installments = Convert.ToInt32(model.Installments); ObjToUpdate.Remarks = model.Remarks; _context.SemesterFeeMappings.Update(ObjToUpdate); await _context.SaveChangesAsync(); } _serviceResponse.Message = CustomMessage.Updated; _serviceResponse.Success = true; return(_serviceResponse); }