Пример #1
0
        public async Task <ActionResult> GetFridgeList()
        {
            var retval = await _fridgeService.Get();

            //var fridgesV = new List<FridgeM>

            return(Ok(retval));
        }
        public async Task <ActionResult> PostUserFridgeDetail([FromBody] AddFridgeModel fridge)
        {
            var result = await _userfridgeService.IsAccess(fridge.Name, fridge.PasswordHash);

            if (result)
            {
                var db_fridge = (await _fridgeService.Get(m => m.Name == fridge.Name)).SingleOrDefault();
                var userId    = User.Claims.First(c => c.Type == "UserID").Value;
                var retval    = new UserFridge {
                    UserId = userId, FridgeId = db_fridge.Id
                };
                await _userfridgeService.Add(retval);

                return(Ok(retval));
            }
            return(NotFound());
        }