コード例 #1
0
        public IDataResult <List <WeeklyPlanView> > GetAllByMonthlyPlan(MonthInfoDto monthInfoDto)
        {
            var firstDateOfMonth = new DateTime(monthInfoDto.Year, monthInfoDto.Month, 1);
            var lastDateOfMonth  = firstDateOfMonth.AddMonths(1).AddDays(-1);

            var firstWeek = firstDateOfMonth.Week();
            var lastWeek  = lastDateOfMonth.Week();

            return(new SuccessDataResult <List <WeeklyPlanView> >(_weeklyPlanDal.GetListAsView(w => w.UserId == UserId && w.Year == monthInfoDto.Year && firstWeek <= w.WeekNumber && w.WeekNumber <= lastWeek).ToList()));
        }
コード例 #2
0
        public IActionResult GetByMonthlyPlanId(MonthInfoDto monthInfoDto)
        {
            var result = _weeklyPlanService.GetAllByMonthlyPlan(monthInfoDto);

            if (result.Success)
            {
                return(Ok(result.Data));
            }

            return(BadRequest(result.Message));
        }