Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="viewModel"></param>
        /// <returns></returns>
        public async Task EditByViewModelAsync(PresenterEditViewModel viewModel)
        {
            // Check
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            // Process
            var present = await _presenters.FirstOrDefaultAsync(model => model.Id == viewModel.Id);

            _mapper.Map(viewModel, present);
            await _unitOfWork.SaveAllChangesAsync(auditUserId : _httpContextManager.CurrentUserId());
        }
Example #2
0
        public virtual async Task <ActionResult> Edit(PresenterEditViewModel viewModel)
        {
            if (viewModel == null)
            {
                return(View(MVC.Error.Views.BadRequest));
            }

            if (ModelState.IsValid == false)
            {
                return(View(MVC.Presenter.Views.Create));
            }

            await _presenterService.EditByViewModelAsync(viewModel);

            this.AddToastMessage("ویرایش پزشک با موفقیت انجام شد", "", ToastType.Success);
            return(RedirectToAction(MVC.Presenter.List()));
        }