public async Task <AccountCryptoModelBussines <int> > CreateAsync(AccountCryptoModelBussines <int> model) { var accCrypto = await _context.AccountCryptos.AddAsync( AutoMapperConfig.Mapper.Map <AccountCryptoModel <int> >(model) ); await _context.SaveChangesAsync(); return(await GetByIdAsync(accCrypto.Entity.Id)); }
public async Task <NotificationModelBussines <int> > CreateAsync(NotificationModelBussines <int> model) { var res = await _context.Notifications.AddAsync( AutoMapperConfig.Mapper.Map <NotificationModel <int> >(model) ); await _context.SaveChangesAsync(); return(await GetByIdAsync(res.Entity.Id)); }
public async Task<AccountSubscriptionModelBussines<int>> CreateAsync(AccountSubscriptionModelBussines<int> model) { var res = await _context.AccountSubscriptions.AddAsync( AutoMapperConfig.Mapper.Map<AccountSubscriptionModel<int>>(model) ); await _context.SaveChangesAsync(); return await GetByUserIdAsync(res.Entity.AccountId); }
public async Task <bool> DeleteByIdAsync(int id) { var subType = await GetRawById(id); subType.IsDeleted = true; _context.Subscriptions.Update(subType); await _context.SaveChangesAsync(); return((await this.GetRawById(id)).IsDeleted); }
public async Task <bool> DeleteByIdAsync(int id) { var accAccInfo = await GetRawByIdAsync(id); var acc = accAccInfo.Item1; acc.IsDeleted = true; _context.Accounts.Update(acc); await _context.SaveChangesAsync(); return(true); }
public async Task <RootFolderModelBussines <int> > UpdateAsync(int id, RootFolderModelBussines <int> model) { model.Id = id; _context.RootFolders.Update(AutoMapperConfig.Mapper.Map <RootFolderModel <int> >(model)); await _context.SaveChangesAsync(); return(await GetByIdAsync(id)); }
public async Task <StoredFolderModelBussines <int> > UpdateAsync(int id, StoredFolderModelBussines <int> model) { var raw = await this.GetRawByIdAsync(id); raw.IsDeleted = model.IsDeleted; raw.Path = model.Path ?? raw.Path; raw.Size = model.Size; raw.Title = model.Title ?? raw.Title; raw.StoredFolderId = model?.StoredFolderId; raw.RootFolderId = (model.RootFolderId == null && raw.StoredFolderId == null)?raw.RootFolderId:model.RootFolderId; _context.StoredFolders.Update(raw); await _context.SaveChangesAsync(); return(await GetByIdAsync(id)); }