public BaseResponse <Drink> UpdateDrink(Drink drink) { if (drink == null || drink.Id == Guid.Empty) { return(new BaseResponse <Drink>(ResultCodeEnum.InvalidData)); } var drinks = dataLayer.GetDrinksByIdOrName(id: drink.Id, name: drink.Name); if (drinks == null || !drinks.Any(d => d.Id == drink.Id) || drinks.Any(d => d.Name.Equals(drink.Name, StringComparison.InvariantCultureIgnoreCase))) { return(new BaseResponse <Drink>(ResultCodeEnum.Fail)); } else { dataLayer.Update(drink); } return(new BaseResponse <Drink>(ResultCodeEnum.Success, resultItem: drink)); }