public async Task <IActionResult> GetReportsByType(Guid personId, Guid classId, int type, DateTime?date = null) { if (date.HasValue == false) { date = DateTime.UtcNow; } var startDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day); var endDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day, 23, 59, 59); switch (type) { case (int)EnumDailyReportType.NapsSleep: { var naps = await _unitOfWork.DailyReportNaps.GetAsync(x => x.IsActive && x.PersonId == personId && x.ClassId == classId && x.Date >= startDate && x.Date <= endDate); return(PartialView("PartialDailyReportNap", DailyReportNap.Init(naps))); } case (int)EnumDailyReportType.Meals: { var meals = await _unitOfWork.DailyReportMeals.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId && x.ClassId == classId && x.PersonId == personId && x.Date >= startDate && x.Date <= endDate, include : p => p.Include(x => x.DailyReportFoods) ); return(PartialView("PartialDailyReportMeal", DailyReportMeal.Init(meals))); } case (int)EnumDailyReportType.Bathroom: { var baths = await _unitOfWork.DailyReportBathrooms.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId && x.ClassId == classId && x.PersonId == personId && x.Date >= startDate && x.Date <= endDate ); return(PartialView("PartialDailyReportBathroom", DailyReportBathroom.Init(baths))); } case (int)EnumDailyReportType.Medication: { var medications = await _unitOfWork.DailyReportMedications.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId && x.ClassId == classId && x.PersonId == personId && x.Date >= startDate && x.Date <= endDate ); return(PartialView("PartialDailyReportMedication", DailyReportMedication.Init(medications))); } } return(View()); }
public async Task <IActionResult> AddEditNap(Guid personId, Guid classId, Guid organizationId, DateTime?date = null) { if (date.HasValue == false) { date = DateTime.UtcNow; } var model = DailyReportNap.Init(personId, classId, organizationId, date.Value); return(View(model)); }
public async Task <IActionResult> GetNaps(Guid personId, Guid classId, Guid organizationId, DateTime?date) { if (date.HasValue == false) { date = DateTime.UtcNow; } var startDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day); var endDate = new DateTime(date.Value.Year, date.Value.Month, date.Value.Day, 23, 59, 59); var naps = await _unitOfWork.DailyReportNaps.GetAsync(x => x.IsActive && x.OrganizationId == _organizationId && x.ClassId == classId && x.PersonId == personId && x.Date >= startDate && x.Date <= endDate ); return(PartialView("PartialDailyReportNap", DailyReportNap.Init(naps))); }