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())); }
public IActionResult GetByMonthlyPlanId(MonthInfoDto monthInfoDto) { var result = _weeklyPlanService.GetAllByMonthlyPlan(monthInfoDto); if (result.Success) { return(Ok(result.Data)); } return(BadRequest(result.Message)); }