Beispiel #1
0
        public async Task <(bool, int)> AddAsync(StoreStruct storeStruct)
        {
            EntityEntry <StoresEntity> s = await context.Stores.AddAsync(new StoresEntity
            {
                Name         = storeStruct.Name,
                Address      = storeStruct.Address,
                WorkingHours = storeStruct.WorkingHours
            });

            try
            {
                return((await context.SaveChangesAsync()) > 0, s.Entity.Id);
            }
            catch (DbUpdateException dbe)
            {
                throw new ExistsInDBException(ExceptionMessages.CannotAddStore(), dbe);
            }
        }