Beispiel #1
0
        public async static Task Initialize(RepositoryContext context, IEnumerable <User> users)
        {
            await context.Database.MigrateAsync();

            var userCount = await context.Users.CountAsync().ConfigureAwait(false);

            if (userCount == 0)
            {
                await context.Users.AddRangeAsync(users);

                await context.SaveChangesAsync().ConfigureAwait(false);
            }
        }
Beispiel #2
0
        public async Task <ReturnResult> UpdateDepartment(Department department)
        {
            ReturnResult result;
            //try
            //{
            var ExistDept = FindByCondition(x => x.Id == department.Id).AsNoTracking().FirstOrDefault();

            if (ExistDept == null)
            {
                result = new ReturnResult()
                {
                    Succeeded = false,
                    Error     = "Department Not Exist"
                };
            }

            Update(department);

            int retVal = await RepositoryContext.SaveChangesAsync();

            result = new ReturnResult()
            {
                Succeeded = true,
                Error     = ""
            };
            //}
            //catch (Exception x)
            //{
            //    result = new ReturnResult()
            //    {
            //        Succeeded = false,
            //        Error = x.Message
            //    };
            //}

            return(result);
        }
Beispiel #3
0
 public Task SaveAsync() => _repoContext.SaveChangesAsync();
Beispiel #4
0
 public void SaveAsync()
 {
     _repoContext.SaveChangesAsync();
 }
Beispiel #5
0
 public async Task SaveAsync()
 {
     await _repoContext.SaveChangesAsync();
 }
Beispiel #6
0
 public async Task <bool> SaveAsync()
 {
     return(await _repositoryContext.SaveChangesAsync() > 0);
 }
Beispiel #7
0
 public async Task <bool> SaveChargesAsync()
 {
     return((await _context.SaveChangesAsync()) > 0);
 }
Beispiel #8
0
 public async Task <int> SaveChanges()
 {
     return(await _repositoryContext.SaveChangesAsync());
 }
Beispiel #9
0
 public Task SaveAsync() => _context.SaveChangesAsync();
Beispiel #10
0
 public async Task DeleteOwnerAsync(Owner owner)
 {
     Delete(owner);
     await RepositoryContext.SaveChangesAsync();
 }
 public async Task Save()
 {
     await _repositoryContext.SaveChangesAsync();
 }
Beispiel #12
0
 public async Task SaveChangesAsync()
 {
     await _repositoryContext.SaveChangesAsync().ConfigureAwait(false);
 }
Beispiel #13
0
 public async Task SaveChangesAsync()
 {
     await context.SaveChangesAsync();
 }
Beispiel #14
0
 public Task Save() => RepositoryContext.SaveChangesAsync();
Beispiel #15
0
 public async Task SaveAsync()
 {
     await repository.SaveChangesAsync();
 }
Beispiel #16
0
 public async Task SaveAsync()
 {
     var result = await _repoContext.SaveChangesAsync();
 }