/// <summary> /// It seems that it's impossible to pass different parameters to the /// same action from a razor view form, so instead different actions are /// called from the view and they are relayed here with corresponding status /// </summary> private async Task <IActionResult> ChangeStatus(DocumentStatus status, SubmitStatusChangeViewModel model) { if (!ModelState.IsValid) { return(View("Details", model)); } var userId = await authService.GetUserIdByClaims(User); var success = await documentService.ChangeStatus(model.DocumentId, userId, status, model.Message); if (!success) { ModelState.AddModelError(string.Empty, "An error has occured while changing document status"); } return(RedirectToAction("Details", "Document", new { id = model.DocumentId })); }
public async Task <IActionResult> Done(SubmitStatusChangeViewModel model) { return(await ChangeStatus(DocumentStatus.Done, model)); }
public async Task <IActionResult> Register(SubmitStatusChangeViewModel model) { return(await ChangeStatus(DocumentStatus.Registered, model)); }
public async Task <IActionResult> Cancel(SubmitStatusChangeViewModel model) { return(await ChangeStatus(DocumentStatus.Canceled, model)); }