public async Task SaveCustomerRecallForExecutor(RecallDTO recallDTO) { if (recallDTO.CustomerCommentForExecutor == null) { } Recall recall = _mapper.Map <Recall>(recallDTO); await _database.Recalls.AddCustomerRecallPropertiesForExecutor(recall); }
public async Task <ActionResult> SaveExecutorRecallForCustomer(UserActivityViewModel activityModel) { var clientId = Session["Id"]; if (clientId == null) { return(RedirectToAction("Registration", "Executor")); } if (activityModel.Mark == null) { TempData["ErrorMessage"] = "Вы не оценили действия заказчика!"; return(RedirectToAction("ShowIndent", "Indent", new { id = activityModel.IndentId })); } int executorId = Convert.ToInt32(clientId); string executorName = Session["Name"].ToString(); RecallDTO recallDTO = new RecallDTO() { RecallId = activityModel.IndentId, ExecutorCommentForCustomer = activityModel.Comment, ExecutorMarkForCustomer = activityModel.Mark }; await _userActivityService.SaveExecutorRecallForCustomer(recallDTO); string cacheKeyForIndent = "show-indent-" + activityModel.IndentId.ToString(); IndentDTO cachedIndent = HttpContext.Cache[cacheKeyForIndent] as IndentDTO; if (cachedIndent != null) { HttpContext.Cache.Remove(cacheKeyForIndent); } string cacheKeyForCustomer = "show-customer-" + activityModel.UserOpponentId.ToString(); CustomerDTO cachedCustomer = HttpContext.Cache[cacheKeyForCustomer] as CustomerDTO; if (cachedCustomer != null) { HttpContext.Cache.Remove(cacheKeyForCustomer); } NotificationDTO notificationDTO = GenerateNotification(activityModel, Role.Customer, "Recall"); notificationDTO.FromId = executorId; notificationDTO.FromName = executorName; await _userActivityService.SaveNotification(notificationDTO); return(RedirectToAction("ShowIndent", "Indent", new { id = activityModel.IndentId })); }
public async Task SaveExecutorRecallForCustomer(RecallDTO recallDTO) { Recall recall = _mapper.Map <Recall>(recallDTO); await _database.Recalls.AddExecutorRecallPropertiesForCustomer(recall); }