Exemplo n.º 1
0
        public IActionResult EditDay(int weekId, DaysOfWeek dayName)
        {
            try
            {
                var model = _repository.GetDay(weekId, dayName);
                if (model == null)
                {
                    model = _repository.AddDay(new Day {
                        WeekId = weekId, DayName = dayName
                    });
                }
                else
                {
                    _repository.DeleteCalculationsByDay(model);
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }