Ejemplo n.º 1
0
        public async Task <IActionResult> Edit([Bind("Name")] OfficeViewModel viewModel, Guid contentId)
        {
            if (!string.IsNullOrWhiteSpace(viewModel.Name) && contentId != Guid.Empty)
            {
                var model = await _officeUoW.GetByContentIdAsync(contentId);

                return(RedirectToAction(nameof(Index)));
            }

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Name")] OfficeViewModel viewModel)
        {
            if (ModelState.IsValid && !string.IsNullOrWhiteSpace(viewModel.Name))
            {
                var model = _mapper.Map <OfficeViewModel, OfficeModel>(viewModel);
                await _officeUoW.InsertAsync(model);

                return(RedirectToAction(nameof(Index)));
            }

            return(View(viewModel));
        }