public object DeleteFoods(Dictionary <string, object> dicParas) { try { string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;//获取手机令牌 string mobile = string.Empty; if (!MobileTokenBusiness.ExistToken(MobileToken, out mobile)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌无效")); } string FoodID = dicParas.ContainsKey("foodid") ? dicParas["foodid"].ToString() : string.Empty;//获取套餐ID int ID = int.Parse(FoodID); IFoodsService foodsService = BLLContainer.Resolve <IFoodsService>("XCCloudRS232"); var foods = foodsService.GetModels(x => x.FoodID == ID).FirstOrDefault <t_foods>(); if (foods == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到套餐信息")); } foods.FoodState = 0; foodsService.Update(foods); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } catch (Exception e) { throw e; } }
public FoodController(IFoodService iFoodService, IFoodsService foodsService, IWebHostEnvironment webHostEnvironment, TagService tagService) { this.iFoodService = iFoodService; this.foodsService = foodsService; this.webHostEnvironment = webHostEnvironment; this.tagService = tagService; }
public DietsService(IDeletableEntityRepository <Diet> dietsRepository, ApplicationDbContext db, IFoodsService foodsService, IUsersService usersService) { this.dietsRepository = dietsRepository; this.db = db; this.foodsService = foodsService; this.usersService = usersService; }
public async Task <ActionResult <ManageFoodSentimentResponse> > ManageFoodSentiment ( [FromServices] IFoodsService foodsService, [FromBody] ManageFoodSentimentRequest request ) { return(await foodsService.ManageFoodSentiment(request.FoodId, IdentityHelper.GetIdFromUser(User), request.Sentiment)); }
public async Task <ActionResult <VotableAttribute> > AddOrUpdateFoodMiscellaneousAttribute ( [FromServices] IFoodsService foodsService, [FromBody] AddOrUpdateVotableAttributeRequest request ) { return(await foodsService.AddOrUpdateAttribute(request, IdentityHelper.GetIdFromUser(User), VotableAttributeType.Miscellaneous)); }
public async Task <ActionResult> DeleteFoodToTry ( [FromServices] IFoodsService foodsService, [FromBody] FoodToTry food ) { food.UserId = IdentityHelper.GetIdFromUser(User); await foodsService.AddOrRemoveFoodToTry(food.FoodId, food.UserId); return(NoContent()); }
public async Task <ActionResult <IEnumerable <FoodResponse> > > SearchFoods ( [FromServices] IFoodsService foodsService, [FromQuery] string query, [FromQuery] string filter ) { var searchTypes = FoodSearchType.GetAllTypes(); var searchFilter = filter.Split(",").Where(f => FoodSearchType.GetAllTypes().Contains(f.ToLower())).ToList(); return((await foodsService.SearchFoods(query, searchFilter, IdentityHelper.GetIdFromUser(User))).ToList()); }
public async Task <ActionResult <FoodResponse> > PostFood( [FromServices] IFoodsService foodsService, [FromForm] CreateFoodRequest food ) { if (food.Name.IsNullOrWhitespace()) { throw new ErrorResponse(HttpStatusCode.BadRequest, "A name must be entered.", DescriptiveErrorCodes.FoodMissingName); } return(await foodsService.AddFood(food, IdentityHelper.GetIdFromUser(User))); }
public ProductsService(IFoodsService foodsService) { _foodsService = foodsService; _products = new List <ProductModel>(); _products.Add(new ProductModel() { Id = 1, Type = "Chocolate", Name = "Sublime", Brand = "Nestle", Price = 2, FoodId = 1 //FoodModel with "Candy" name }); _products.Add(new ProductModel() { Id = 2, Type = "Gummies", Name = "Cerebritos", Brand = "Mogul", Price = 2.50, FoodId = 1 //FoodModel with "Candy" name }); _products.Add(new ProductModel() { Id = 3, Type = "Chicken", Name = "Chicken wing", Brand = "Imba", Price = 7, FoodId = 2 //FoodModel with "Meat" name }); _products.Add(new ProductModel() { Id = 4, Type = "Sausage", Name = "Sausage 8pack", Brand = "Stege", Price = 16, Discount = 0.2, //% FoodId = 2 //FoodModel with "Meat" name }); }
public object AddFoods(Dictionary <string, object> dicParas) { try { string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty; //获取手机令牌 string DeviceToken = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty; //获取设备token string FoodName = dicParas.ContainsKey("foodname") ? dicParas["foodname"].ToString() : string.Empty; //获取套餐名称 string FoodPrice = dicParas.ContainsKey("foodprice") ? dicParas["foodprice"].ToString() : string.Empty; //获取套餐价格 string CoinQuantity = dicParas.ContainsKey("coinquantity") ? dicParas["coinquantity"].ToString() : string.Empty; //获取币数量 string IsQuickFood = dicParas.ContainsKey("isquickfood") ? dicParas["isquickfood"].ToString() : string.Empty; //获取是否允许散客购买0不允许,1允许 string FoodState = dicParas.ContainsKey("foodstate") ? dicParas["foodstate"].ToString() : string.Empty; //获取是否有效 1有效 IMerchService merchService = BLLContainer.Resolve <IMerchService>("XCCloudRS232"); var merchlist = merchService.GetModels(x => x.Token == MobileToken && x.State == 1).FirstOrDefault <Base_MerchInfo>(); if (merchlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌无效")); } var devicelist = DeviceBusiness.GetDeviceModel(DeviceToken); if (devicelist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备令牌无效")); } t_foods foods = new t_foods(); IFoodsService foodsService = BLLContainer.Resolve <IFoodsService>("XCCloudRS232"); foods.MerchID = merchlist.ID; foods.DeviceID = devicelist.ID; foods.FoodName = FoodName; foods.FoodPrice = Convert.ToDecimal(FoodPrice); foods.IsQuickFood = int.Parse(IsQuickFood); foods.FoodState = int.Parse(FoodState); foods.CoinQuantity = int.Parse(CoinQuantity); foodsService.Add(foods); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } catch (Exception e) { throw e; } }
public async Task <ActionResult <IEnumerable <FoodResponse> > > GetFoodsToTry ( [FromServices] IFoodsService foodsService ) => (await foodsService.GetFoodsToTry(IdentityHelper.GetIdFromUser(User))).ToList();
public async Task <ActionResult <FoodResponse> > GetFood ( [FromServices] IFoodsService foodsService, int id ) => await foodsService.GetFoodDetails(id, IdentityHelper.GetIdFromUser(User));
public FoodsController(IFoodsService foodsService, IStatisticsService statisticsService, IMapper mapper) { this.foodsService = foodsService; this.statisticsService = statisticsService; this.mapper = mapper; }
public CommentsService(MouthfeelContext mouthfeel, IFoodsService foods, IUsersService users) { _mouthfeel = mouthfeel; _foods = foods; _users = users; }
public DietsController(IDietsService dietsService, IFoodsService foodsService) { this.dietsService = dietsService; this.foodsService = foodsService; }
public FoodsController(IFoodService iFoodService, IFoodsService foodsService, ICategoriesService iCategoriesService) { this.iFoodService = iFoodService; this.foodsService = foodsService; this.iCategoriesService = iCategoriesService; }
public FoodsController(IFoodsService foodsService) { _foodsService = foodsService; }
public ProductsService(IFoodsService foodsService, IMapper mapper) { _foodsService = foodsService; _mapper = mapper; }