예제 #1
0
        /// <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 }));
        }
예제 #2
0
 public async Task <IActionResult> Done(SubmitStatusChangeViewModel model)
 {
     return(await ChangeStatus(DocumentStatus.Done, model));
 }
예제 #3
0
 public async Task <IActionResult> Register(SubmitStatusChangeViewModel model)
 {
     return(await ChangeStatus(DocumentStatus.Registered, model));
 }
예제 #4
0
 public async Task <IActionResult> Cancel(SubmitStatusChangeViewModel model)
 {
     return(await ChangeStatus(DocumentStatus.Canceled, model));
 }