public ActionResult AddUpdateCardType(tbl_Card_Types request, List <tbl_Card_Types> upgradeTypes, int?RequestId = null) { if (RequestId.HasValue) { var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault(), "R"); var CardTypeDetails = CardTypeMethods.GetCardTypeById(request.ID); CardTypeDetails.tbl_Card_Upgrade_Types1 = new List <tbl_Card_Upgrade_Types>(); CardTypeDetails.tbl_Card_Charges = new List <tbl_Card_Charges>(); var existingJson = CardTypeDetails == null ? null : CustomHelper.GetJson(CardTypeDetails); upgradeTypes.ForEach(e => request.tbl_Card_Upgrade_Types.Add(new tbl_Card_Upgrade_Types { ParentCardType = e.ID, ChildCardType = request.ID })); var updatedJson = CustomHelper.GetJson(request); tbl_System_Requests row = new tbl_System_Requests(); if (RequestId.GetValueOrDefault() <= 0) { row = new tbl_System_Requests { AuthorizationStatus = "P", CreatorID = StateHelper.UserId, IsActive = true, ExistingData = existingJson, UpdatedData = updatedJson, RequestType = Constants.RequestTypes.CardTypes_SystemRequest }; } else { row = getSystemRequest; row.CreatorID = StateHelper.UserId; row.AuthorizationStatus = "P"; row.AuthorizationComments = string.Empty; row.UpdatedData = updatedJson; row.ExistingData = existingJson; } var SystemRequestFlag = (RequestId.HasValue && RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row); return(Json(new { IsSuccess = SystemRequestFlag, ErrorMessage = SystemRequestFlag == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = SystemRequestFlag }, JsonRequestBehavior.AllowGet)); } else { request.IsActive = true; upgradeTypes = upgradeTypes ?? new List <tbl_Card_Types>(); //New Card Type var response = request.ID <= 0 ? new CardTypesDataAccess().AddCardType(request, upgradeTypes) : new CardTypesDataAccess().UpdateCardType(request, upgradeTypes); return(Json(new { IsSuccess = response, ErrorMessage = response == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = response }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddUpdateCardType(int?Id) { CardTypeVM viewModel = new CardTypeVM(); ViewBag.RequestId = Id ?? 0; if (Id.HasValue) { viewModel = CardTypeMethods.GetCardTypeById(Id.GetValueOrDefault(), "R"); ViewBag.CardTypes = new CardTypesDataAccess().GetCardTypesActiveInactive("A"); if (Id.GetValueOrDefault() > 0 && viewModel == null) { return(RedirectToAction("ReviewCardTypeScreen", "Review")); } } else { ViewBag.CardTypes = new CardTypesDataAccess().GetCardTypesActiveInactive("A"); } ViewBag.RequestType = "Add"; return(View(viewModel)); }
public ActionResult GetCardTypeDetail(int Id, string Status = default(string)) { var CardTypes = CardTypeMethods.GetCardTypeById(Id, Status); return(Json(new { IsSuccess = CardTypes == null ? false : true, ErrorMessage = CardTypes == null ? CustomMessages.GenericErrorMessage : string.Empty, Response = CardTypes }, JsonRequestBehavior.AllowGet)); }