public JsonResult FormSubmitted(FormActionVM form) { StepHandler step = new StepHandler(unitOfWork); try { if (!ModelState.IsValid) { return(Json(null)); } else { var reservationId = long.Parse(form.ReservationId); form.LoggedUser = LoggedUserId; CancelledByCustomerFormAction builder = (CancelledByCustomerFormAction)step .InitiateSteperCByCustomer(reservationId, (int)SixtCancellationStatusEnum.CancelledByCustomer); if (builder == null) { return(Json(new { success = false, Message = "Failed , No steps found " })); } builder.PerformAction(form); if (unitOfWork.Complete() > 0) { var Count = unitOfWork.NotificationBL.GetCountUnSeenNotification(LoggedUserId); _ = Notify.UpdateUnseenCount(LoggedUserId, Count); return(Json(new { success = true, Message = "Form submitted successfuly" })); } else { return(Json(new { success = false, Message = "Failed to submit form" })); } } } catch (Exception e) { return(Json(new { success = false, Message = "An error occured , please try again later" })); } }
public JsonResult AssignAgent_Multiple(AgentAssignmentVM assignObj) { StepHandler step = new StepHandler(unitOfWork); try { if (!ModelState.IsValid) { return(Json(null)); } else { var date = DateTime.Now; var reservationNumbers = assignObj.ReservationNo; if (reservationNumbers?.Length > 0) { for (int i = 0; i < reservationNumbers.Length; i++) { CancelledByCustomerAgentAssignment builder = (CancelledByCustomerAgentAssignment)step .InitiateSteperCByCustomer(reservationNumbers[i], (int)SixtCancellationStatusEnum.CancelledByCustomer); if (builder == null) { return(Json(new { success = false, Message = "Failed , No steps found " })); } builder.PerformAction(new AgentAssignmentVM() { FromUser = LoggedUserId, userId = assignObj.AssigneeId }); } if (unitOfWork.Complete() > 0) { var Count = unitOfWork.NotificationBL.GetCountUnSeenNotification(LoggedUserId); // var users = unitOfWork.UserBL.Find(u => u.IsActive == true).Select(u => u.Id).ToList(); _ = Notify.UpdateUnseenCount(LoggedUserId, Count); return(Json(new { success = true, Message = "Assignment(s) added successfuly" })); } else { return(Json(new { success = false, Message = "Failed to add assignment(s)" })); } } else { return(Json(new { success = false, Message = "No items selected" })); } } } catch (Exception e) { return(Json(new { success = false, Message = "An error occured , please try again later" })); } }