Example #1
0
        public static RecipientUpdateOutputDtoModel Map(RecipientUpdateOutputViewModel viewModel)
        {
            var dtoModel = new RecipientUpdateOutputDtoModel
            {
                RecipientId = viewModel.RecipientId
            };

            return(dtoModel);
        }
Example #2
0
        public async Task <IActionResult> Update(RecipientUpdateOutputViewModel outputViewModel)
        {
            if (!this.User.IsInRole(GlobalConstants.AdministratorRoleName))
            {
                return(this.Redirect("/Identity/Account/AccessDenied"));
            }

            if (!this.ModelState.IsValid)
            {
                var error = new RecipientError();
                error.ErrorMessage = GlobalConstants.RecipientUpdateModelValidationMessege;
                return(this.RedirectToAction("Error", "Recipient", error));
            }

            var dtoModel       = RecipientUpdateOutputViewMapper.Map(outputViewModel);
            var paramsDtoModel = await this.recipientService.GetRecipientParamsForUpdateAsync(dtoModel);

            var paramsViewModel = RecipientUpdateParamsMapper.Map(paramsDtoModel);

            return(this.View(paramsViewModel));
        }