Exemplo n.º 1
0
        public JsonResult PostHoliday(HolidayViewModel holiday)
        {
            Guard.Against.Null(holiday, nameof(holiday));
            IList <TmHoliday> list = new List <TmHoliday>();

            if (holiday.Holidays != null)
            {
                foreach (var day in holiday.Holidays)
                {
                    TmHoliday model = new TmHoliday();
                    model.CaseUid = holiday.CaseUid;
                    model.Holiday = day;
                    DayOfWeek dw = Convert.ToDateTime(day).DayOfWeek;
                    if (dw == DayOfWeek.Sunday)
                    {
                        model.HodidayNote = "星期天";
                    }
                    else if (dw == DayOfWeek.Saturday)
                    {
                        model.HodidayNote = "星期六";
                    }
                    else
                    {
                        model.HodidayNote = "节假日";
                    }
                    list.Add(model);
                }
            }
            _timeService.AddHoliday(holiday.CaseUid, list);
            return(Json(ResponseViewModelUtils.Sueecss()));
        }