public async Task <bool> Create(StoreWarrantyService StoreWarrantyService) { StoreWarrantyServiceDAO StoreWarrantyServiceDAO = new StoreWarrantyServiceDAO(); StoreWarrantyServiceDAO.Id = StoreWarrantyService.Id; StoreWarrantyServiceDAO.Name = StoreWarrantyService.Name; StoreWarrantyServiceDAO.Detail = StoreWarrantyService.Detail; StoreWarrantyServiceDAO.StoreId = StoreWarrantyService.StoreId; DataContext.StoreWarrantyService.Add(StoreWarrantyServiceDAO); await DataContext.SaveChangesAsync(); StoreWarrantyService.Id = StoreWarrantyServiceDAO.Id; await SaveReference(StoreWarrantyService); return(true); }
public async Task <bool> BulkMerge(List <StoreWarrantyService> StoreWarrantyServices) { List <StoreWarrantyServiceDAO> StoreWarrantyServiceDAOs = new List <StoreWarrantyServiceDAO>(); foreach (StoreWarrantyService StoreWarrantyService in StoreWarrantyServices) { StoreWarrantyServiceDAO StoreWarrantyServiceDAO = new StoreWarrantyServiceDAO(); StoreWarrantyServiceDAO.Id = StoreWarrantyService.Id; StoreWarrantyServiceDAO.Name = StoreWarrantyService.Name; StoreWarrantyServiceDAO.Detail = StoreWarrantyService.Detail; StoreWarrantyServiceDAO.StoreId = StoreWarrantyService.StoreId; StoreWarrantyServiceDAOs.Add(StoreWarrantyServiceDAO); } await DataContext.BulkMergeAsync(StoreWarrantyServiceDAOs); return(true); }
public async Task <bool> Update(StoreWarrantyService StoreWarrantyService) { StoreWarrantyServiceDAO StoreWarrantyServiceDAO = DataContext.StoreWarrantyService.Where(x => x.Id == StoreWarrantyService.Id).FirstOrDefault(); if (StoreWarrantyServiceDAO == null) { return(false); } StoreWarrantyServiceDAO.Id = StoreWarrantyService.Id; StoreWarrantyServiceDAO.Name = StoreWarrantyService.Name; StoreWarrantyServiceDAO.Detail = StoreWarrantyService.Detail; StoreWarrantyServiceDAO.StoreId = StoreWarrantyService.StoreId; await DataContext.SaveChangesAsync(); await SaveReference(StoreWarrantyService); return(true); }