public ActionResult ExistingResponseToProject(string id) { var project = RepositoryContext.Current.GetOne <Project>(pr => pr._id == id); if (project != null) { var viewModel = new ExistingResponseViewModel(); viewModel.ProjectId = id; viewModel.ResponseId = ObjectId.GenerateNewId().ToString(); viewModel.ResponseTime = DateTime.Now; return(PartialView(viewModel)); } return(HttpNotFound("Проект не найден, свяжитесь с администратором")); }
public ActionResult ExistingResponseToProject(ExistingResponseViewModel model) { if (ModelState.IsValid) { var project = RepositoryContext.Current.GetOne <Project>(p => p.InvestorUser == model.UserName); if (project != null) { return(View(model)); } ModelState.AddModelError("ExistingUser", new AuthenticationException("пользователь не существует")); return(View(model)); } return(View(model)); }