Exemple #1
0
        public async Task <IActionResult> Create(WorkViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                await _workService.Create(viewModel);

                return(View(viewModel));
            }

            return(View(viewModel));
        }
        public IActionResult Create(WorkViewModel workViewModel)
        {
            if (workViewModel.Images.Count < 5 && workViewModel.Images.Count > 0)
            {
                var work = _mapper.Map <WorkViewModel, Work>(workViewModel);
                _workService.Create(work);
                return(RedirectToAction("GetAll"));
            }

            return(View(workViewModel));
        }
Exemple #3
0
        public IActionResult AddWork(WorkAddDto model)
        {
            if (ModelState.IsValid)
            {
                _workService.Create(new Work
                {
                    Description = model.Description,
                    Name        = model.Name,
                    UrgencyId   = model.UrgencyId
                });

                return(RedirectToAction("Index"));
            }

            ViewBag.Urgencies = new SelectList(_urgenyService.GetAll(), "Id", "Description");

            return(View(model));
        }