예제 #1
0
        public ActionResult Save(PerformanceViewModel performanceViewModel)
        {
            CheckDateTime(performanceViewModel);

            if (!ModelState.IsValid)
            {
                var performanceVm = _performanceService.ReturnPerformanceViewModel
                                        (performanceViewModel.Performance.Id);

                return(View("PerformanceForm", performanceVm));
            }

            if (performanceViewModel.Performance.Id == 0)
            {
                _performanceService.CreatePerformance(performanceViewModel);
            }
            else
            {
                _performanceService.EditPerformance(performanceViewModel, performanceViewModel.Performance.Id);
            }

            return(RedirectToAction("Index"));
        }