public ActionResult PaymentTypeLesserOf(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit) { //To show default percentage as 100 PaymentTypeLesserOfViewModel paymentTypeLesserOfViewModel = new PaymentTypeLesserOfViewModel { Percentage = Constants.PaymentTypeLesserOfPercentage }; if (isEdit) { PaymentTypeLesserOf paymentTypeLesserOfForPost = new PaymentTypeLesserOf { ServiceTypeId = serviceTypeId, ContractId = contractId, PaymentTypeId = paymentTypeId, UserName = GetCurrentUserName() }; //Get the Name of User logged in PaymentTypeLesserOf paymentTypeLesserOf = PostApiResponse <PaymentTypeLesserOf>("PaymentTypeLesserOf", "GetLesserOfPercentage", paymentTypeLesserOfForPost); paymentTypeLesserOfViewModel = AutoMapper.Mapper.Map <PaymentTypeLesserOf, PaymentTypeLesserOfViewModel>(paymentTypeLesserOf); } paymentTypeLesserOfViewModel.PaymentTypeId = (byte)Enums.PaymentTypeCodes.LesserOf; paymentTypeLesserOfViewModel.ServiceTypeId = serviceTypeId; paymentTypeLesserOfViewModel.ContractId = contractId; paymentTypeLesserOfViewModel.IsEdit = isEdit; return(View(paymentTypeLesserOfViewModel)); }
public JsonResult AddEditPaymentTypeLesserOf(PaymentTypeLesserOfViewModel paymentTypeLesserOfViewModel) { //Get the Name of User logged in paymentTypeLesserOfViewModel.UserName = GetCurrentUserName(); PaymentTypeLesserOf paymentTypeLesserOf = AutoMapper.Mapper.Map <PaymentTypeLesserOfViewModel, PaymentTypeLesserOf>(paymentTypeLesserOfViewModel); long paymentTypeLesserOfId = PostApiResponse <long>("PaymentTypeLesserOf", "AddEditPaymentTypeLesserOf", paymentTypeLesserOf); return(paymentTypeLesserOfId > 0 ? Json(new { success = true }) : Json(new { sucess = false })); }