public async Task <IActionResult> ProjectEditPost(int id, ProjectWorkModel model) { if (ModelState.IsValid) { var result = await _crudService.Edit(id, model, Token, ProjectService.ProjectEntity); AddMessageToModel(model, result.Message, !result.Success); } else { AddModelStateErrors(model); } return(View("Edit", model)); }
public async Task <IActionResult> ProjectAddPost(ProjectWorkModel model) { if (ModelState.IsValid) { var result = await _crudService.Create(model, Token, ProjectService.ProjectEntity); AddMessageToModel(model, result.Message, !result.Success); if (result.Success) { return(RedirectToActionWithId(model, "ProjectEdit", "Project", result.Id)); } } else { AddModelStateErrors(model); } return(View("Add", model)); }
public async Task <IActionResult> ProjectEdit(int id) { ProjectWorkModel model = new ProjectWorkModel(); CheckTempData(model); var result = await _crudService.Get <ProjectModel>(id, Token, ProjectService.ProjectEntity); if (result.Success) { model.Id = id; model.Name = result.Value.Name; model.Description = result.Value.Description; } else { AddMessageToModel(model, result.Message); } return(View("Edit", model)); }
public IActionResult ProjectAdd() { ProjectWorkModel model = new ProjectWorkModel(); return(View("Add", model)); }