public JsonNetResult GetFeeById(int Id) { FeeViewModel Fee = new FeeViewModel(); Data.Models.Fee objFee = this._feeService.GetForId(Id); if (Fee != null) { Fee.Id = objFee.Id; Fee.Name = objFee.Name; Fee.Frequency = objFee.Frequency.ToString(); Fee.Amount = objFee.Amount; } return(JsonNet(Fee, JsonRequestBehavior.AllowGet)); }
public int Update(Data.Models.Fee fee) { Data.Models.Fee existingFee = _feeRepository.Table.FirstOrDefault(w => w.Id == fee.Id); if (existingFee != null) { existingFee.Name = fee.Name; existingFee.Frequency = fee.Frequency; existingFee.Amount = fee.Amount; _feeRepository.Update(existingFee); return(existingFee.Id); } else { return(0); } }
public JsonNetResult SaveFee(Data.Models.Fee fee) { JsonResponse response = new JsonResponse(); try { if (fee.Id == 0) { var Id = this._feeService.Insert(fee); } else { this._feeService.Update(fee); } response.Status = ResponseStatus.Success; } catch (Exception ex) { response.Status = ResponseStatus.Error; response.Message = ex.Message + ex.InnerException ?? ex.InnerException.Message; LogException(ex); } return(JsonNet(response, JsonRequestBehavior.AllowGet)); }
public int Insert(Data.Models.Fee fee) { this._feeRepository.Insert(fee); return(fee.Id); }