示例#1
0
        /// <summary>
        /// Post example
        /// </summary>
        /// <param name="startDateDecorator"></param>
        public SynchronizationData Post(DateTimeDecorator startDateDecorator)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Input data format is invalid.");
                return(null);
            }
            DateTime startDate = startDateDecorator.DateTime;
            var      data      = new SynchronizationData();

            context = Request.GetOwinContext().Get <ApplicationDbContext>();

            foodConsistencyTypeService = new FoodConsistencyTypeService(context);
            data.FoodConsistencyTypes  = foodConsistencyTypeService.Get(startDate).ToList();

            foodCategoryService = new FoodCategoryService(context);
            data.FoodCategories = foodCategoryService.Get(startDate).ToList();

            dishCategoryService = new DishCategoryService(context);
            data.DishCategories = dishCategoryService.Get(startDate).ToList();

            foodService = new FoodService(context);
            data.Food   = foodService.Get(startDate).ToList();

            dishService = new DishService(context);
            data.Dishes = dishService.Get(startDate).ToList();

            portionService = new PortionFoodService(context);
            data.Portions  = portionService.Get(startDate).ToList();

            return(data);
        }
示例#2
0
        // GET: FoodCategory
        public ActionResult Index()
        {
            IEnumerable <FoodCategoryViewModel> model = FoodCategoryService.Get()
                                                        .Select(fc => new FoodCategoryViewModel {
                Id = fc.Id,
                DateModification = fc.DateModification,
                Image            = fc.Image,
                IsDeleted        = fc.IsDeleted,
                Name             = fc.Name,
            }).ToList();

            return(View(model));
        }