public JsonResult NoShowAssignAgent_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++) { NoShowAgentAssignment builder = (NoShowAgentAssignment)step .InitiateSteperNoShow(reservationNumbers[i], (int)SixtCancellationStatusEnum.NoShow); 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" })); } }
public JsonResult NoShowFormSubmitted(FormActionVM form) { StepHandler step = new StepHandler(unitOfWork); try { if (!ModelState.IsValid) { return(Json(null)); } else { var reservationId = long.Parse(form.ReservationId); form.LoggedUser = LoggedUserId; NoShowFormAction builder = (NoShowFormAction)step .InitiateSteperNoShow(reservationId, (int)SixtCancellationStatusEnum.NoShow); 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" })); } }