///<summary> ///Allows executor to modificate profile: change 2 categories (once), download photo, change description. ///</summary> public ActionResult ModificateProfile() { if (TempData["ErrorMessage"] != null) { ViewBag.ErrorMessage = TempData["ErrorMessage"]; } var clientId = Session["Id"]; if (clientId == null) { return(RedirectToAction("Registration", "Executor")); } int executorId = Convert.ToInt32(clientId); ExecutorDTO executorDTO = _executorService.GetExecutorPropertiesForEdition(executorId); ExecutorPropertiesForEditionViewModel propertiesViewModel = _mapper.Map <ExecutorPropertiesForEditionViewModel>(executorDTO); return(View(propertiesViewModel)); }
private HelpModelForClientOpportunities SetClientOpportunities(IndentDTO indentDTO, Role?clientRole, int?clientId) { HelpModelForClientOpportunities clientPossibilities = new HelpModelForClientOpportunities(); switch (clientRole) { case Role.Customer: { if (clientId == indentDTO.Customer.CustomerId) { if (indentDTO.Executor == null) { clientPossibilities.customerIsAllowToSelectExecutor = true; } if (indentDTO.Executor != null && (indentDTO.Recall == null || indentDTO.Recall.CustomerMarkForExecutor == null)) { clientPossibilities.customerIsAllowToWriteRecall = true; } } return(clientPossibilities); } case Role.Executor: { if (indentDTO.Executor == null) { int executorId = clientId ?? default(int); ExecutorDTO clientExecutorDTO = _executorService.GetExecutorPropertiesForEdition(executorId); if (clientExecutorDTO.Categories.Count() > 0) { foreach (Category executorCategory in clientExecutorDTO.Categories) { if (executorCategory.Equals(indentDTO.CategoryId)) { clientPossibilities.executorIsAllowToSendResponce = true; foreach (var responce in indentDTO.Responces) { if (responce.Executor.ExecutorId == clientId) { clientPossibilities.executorIsAllowToSendResponce = false; } } } } } } if (indentDTO.Executor != null) { if (indentDTO.Executor.ExecutorId == clientId && (indentDTO.Recall == null || indentDTO.Recall.ExecutorMarkForCustomer == null)) { clientPossibilities.executorIsAllowToWriteRecall = true; } } return(clientPossibilities); } default: return(clientPossibilities); } }