public JsonResult AddCoffeeDevice(string appUserId) { Random random = new Random(); CoffeeDevice coffeeDevice = new CoffeeDevice() { Id = Guid.NewGuid(), AppUserId = appUserId, CurrentCoffeeAmount = random.Next(0, 100), CurrentMilkAmount = random.Next(0, 100), CurrentWaterAmount = random.Next(0, 100) }; bool isAdded = _coffeeRepository.AddCoffeeDevice(coffeeDevice); if (isAdded) { return(new JsonResult(new { message = "ok", coffeDeviceState = GetCurrentUserCoffeeDeviceState(appUserId) })); } else { return(new JsonResult(new { message = "error", coffeDeviceState = GetCurrentUserCoffeeDeviceState(appUserId) })); } }