public ActionResult Edit(RoomTypeRateTypeMappingVM model) { try { string source = string.Empty; string url = string.Empty; string qid = string.Empty; string mappingId = string.Empty; model.IsWeekEndPrice = false; #region Check Source Parameters if (Request.Form["Source"] != null && !string.IsNullOrWhiteSpace(Convert.ToString(Request.Form["Source"]))) { source = Convert.ToString(Request.Form["Source"]); if (source == "WeekDayPrice") { TempData["TabName"] = "WeekDayPrice"; url = Url.Action("ManagePrice", "Rate"); model.IsWeekEndPrice = false; } else if (source == "WeekEndPrice") { TempData["TabName"] = "WeekEndPrice"; url = Url.Action("ManagePrice", "Rate"); model.IsWeekEndPrice = true; } } #endregion model.UpdatedBy = LogInManager.LoggedInUserId; #region Check Room Type Rate Type Mapping Available. if (this.CheckRoomTypeRateTypeMappingAvailable(model.Id, model.RoomTypeId, model.RateTypeId, model.IsWeekEndPrice) == false) { return(Json(new { IsSuccess = false, errorMessage = string.Format("Selected mapping already exist.") }, JsonRequestBehavior.AllowGet)); } #endregion mappingId = rateRepository.UpdateRoomTypeRateTypeMapping(model); #region Check External URL if (!string.IsNullOrWhiteSpace(url)) { return(Json(new { IsSuccess = true, IsExternalUrl = true, data = url }, JsonRequestBehavior.AllowGet)); } #endregion if (!string.IsNullOrWhiteSpace(mappingId)) { return(Json(new { IsSuccess = true, data = new { RoomTypeId = model.Id } }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, errorMessage = "Rate details not updated successfully." }, JsonRequestBehavior.AllowGet)); } } catch (Exception e) { Utility.Utility.LogError(e, "Edit"); return(Json(new { IsSuccess = false, errorMessage = e.Message })); } }