예제 #1
0
        public ActionResult Save(InstructionViewModel instructionViewModel)
        {
            var instructionDto = Mapper.Map <InstructionDto>(instructionViewModel);

            if (!ModelState.IsValid)
            {
                instructionViewModel = new InstructionViewModel();

                return(View("InstructionForm", instructionViewModel));
            }
            if (instructionDto.Id == 0)
            {
                instructionService.Add(instructionDto);
            }
            else
            {
                instructionService.Edit(instructionDto);
            }
            return(RedirectToAction("Index", "Instructions"));
        }