public ActionResult Create([Bind(Include = "MonthlySubscriptionId,SubscriptionMonth,SubscriptionPrice")] MonthlySubscriptionModel MonthlySubscriptionModel) { UserPermissionAction("MonthlySubscription", RoleAction.view.ToString()); CheckPermission(); try { TempData["ShowMessage"] = "error"; TempData["MessageBody"] = "Please fill the required field with valid data"; if (ModelState.IsValid) { //var Location = form["LocationLists"].ToString(); Mapper.CreateMap <Onlo.Models.MonthlySubscriptionModel, Onlo.Entity.MonthlySubscription>(); Onlo.Entity.MonthlySubscription MonthlySubscriptions = Mapper.Map <Onlo.Models.MonthlySubscriptionModel, Onlo.Entity.MonthlySubscription>(MonthlySubscriptionModel); MonthlySubscription Monthly = _MonthlySubscriptionService.GetMonthlySubscriptions().Where(x => x.SubscriptionMonth == MonthlySubscriptions.SubscriptionMonth).FirstOrDefault(); if (Monthly == null) { MonthlySubscriptions.IsActive = true; _MonthlySubscriptionService.InsertMonthlySubscription(MonthlySubscriptions); TempData["ShowMessage"] = "success"; TempData["MessageBody"] = " Monthly Subscription save successfully."; return(RedirectToAction("Index")); // end Update CompanyEquipments } else { TempData["ShowMessage"] = "error"; if (Monthly.SubscriptionMonth.Trim().ToLower() == MonthlySubscriptionModel.SubscriptionMonth.Trim().ToLower()) //Check User Name { TempData["MessageBody"] = Monthly.SubscriptionMonth + " already exist."; } else { TempData["MessageBody"] = "Some unknown problem occured while proccessing save operation on "; } } } } catch (Exception ex) { string ErrorMsg = ex.Message.ToString();// ErrorLogging.LogError(ex); } return(View(MonthlySubscriptionModel)); }
public async Task <IActionResult> MonthlySubscription_Save(MonthlySubscriptionModel model) { await _monthlySubscriptionService.Save_Update(model); return(RedirectToAction("MonthlySubscription", new { id = model.Id })); }