public MealMenuSaveResponse Save(MealMenuSaveRequest request) { return(Execute <MealMenuSaveRequest, MealMenuSaveResponse>( request, response => { foreach (var mealMenu in request.MealMenus) { response.MealMenus.Add(_mealMenuFacade.Update(mealMenu)); } } )); }
public JsonResult SaveMealMenus(MealMenuSaveRequest request) { if (request != null) { var now = DateTime.Now; request.MealMenus.ForEach(d => { d.ModifiedBy = CurrentUser.Name; d.ModifiedAt = now; d.ModifiedByFullName = CurrentUser.FullName; d.CreatedAt = d.CreatedAt == DateTime.MinValue ? now : d.CreatedAt; }); } return(Json(MealMenuService.Save(request), JsonRequestBehavior.DenyGet)); }
public JsonResult SaveMealMenus2(MealMenuSaveRequest request, int mealTypeId, int year, int month, int day) { if (request != null) { var now = DateTime.Now; request.MealMenus.ForEach(d => { d.MealType = new GeneralItemView(mealTypeId, "", ""); d.ModifiedBy = CurrentUser.Name; d.ModifiedAt = now; d.ModifiedByFullName = CurrentUser.FullName; d.CreatedAt = d.CreatedAt == DateTime.MinValue ? now : d.CreatedAt; d.ValidDate = d.ValidDate == DateTime.MinValue ? new DateTime(year, month, day) : d.ValidDate; }); } return(Json(MealMenuService.Save(request), JsonRequestBehavior.DenyGet)); }