public async Task <Either <Failure, IceCream> > AddIceCream(IceCream iceCream)
        {
            try
            {
                Kiosk.IceCreams.Add(iceCream);
                await Kiosk.SaveChangesAsync();

                return(() => iceCream);
            }
            catch (Exception)
            {
                return(() => new DataAccessFailure("An error has occured"));
            }
        }
Exemple #2
0
        public async Task <Either <Failure, Store> > AddStore(Store store)
        {
            try
            {
                Kiosk.Stores.Add(store);
                await Kiosk.SaveChangesAsync();

                return(() => store);
            }
            catch (Exception)
            {
                return(() => new DataAccessFailure("An error has occured"));
            }
        }