public Status UpdateIceCream(IceCream iceCream) { IceCreamValidation iceCreamValidation = new IceCreamValidation(); Status status = Status.Success; try { if (iceCreamValidation.IsIceCreamValid(iceCream)) { iceCreamService.UpdateIceCream(iceCream); } else { status = Status.InvalidName; } } catch (Exception) { status = Status.DBError; } return(status); }
public async Task <Status> AddIceCream(IceCream iceCream) { IceCreamValidation iceCreamValidation = new IceCreamValidation(); Status status = Status.Success; iceCream.IceCreamId = Guid.NewGuid(); try { if (iceCreamValidation.IsIceCreamValid(iceCream)) { await iceCreamService.AddIceCream(iceCream); } else { status = Status.InvalidName; } } catch (Exception) { status = Status.DBError; } return(status); }