public async Task CreateOrUpdateStore(GetStoreForEditInput input) { if (string.IsNullOrEmpty(input.Store.Id)) { await CreateStoreAsync(input); } else { await UpdateStoreAsync(input); } }
protected virtual async Task UpdateStoreAsync(GetStoreForEditInput input) { var store = await _storeRepository.FirstOrDefaultAsync(u => u.Id == input.Store.Id); //Update user properties input.Store.MapTo(store); //Passwords is not mapped (see mapping configuration) store.ModifyMan = AsyncHelper.RunSync(() => UserManager.GetUserByIdAsync((long)AbpSession.UserId)).Name; store.ModifyTime = DateTime.Now; await _storeRepository.UpdateAsync(store); await CurrentUnitOfWork.SaveChangesAsync(); }
protected virtual async Task CreateStoreAsync(GetStoreForEditInput input) { var store = input.Store.MapTo <Store>(); store.Id = Guid.NewGuid().ToString().ToUpper(); store.IsDelete = false; store.AddMan = AsyncHelper.RunSync(() => UserManager.GetUserByIdAsync((long)AbpSession.UserId)).Name; store.AddTime = DateTime.Now; store.ModifyMan = AsyncHelper.RunSync(() => UserManager.GetUserByIdAsync((long)AbpSession.UserId)).Name; store.ModifyTime = DateTime.Now; await _storeRepository.InsertAsync(store); await CurrentUnitOfWork.SaveChangesAsync(); }