public async Task <bool> Create(RelationshipCustomerType RelationshipCustomerType) { RelationshipCustomerTypeDAO RelationshipCustomerTypeDAO = new RelationshipCustomerTypeDAO(); RelationshipCustomerTypeDAO.Id = RelationshipCustomerType.Id; RelationshipCustomerTypeDAO.Name = RelationshipCustomerType.Name; DataContext.RelationshipCustomerType.Add(RelationshipCustomerTypeDAO); await DataContext.SaveChangesAsync(); RelationshipCustomerType.Id = RelationshipCustomerTypeDAO.Id; await SaveReference(RelationshipCustomerType); return(true); }
public async Task <bool> BulkMerge(List <RelationshipCustomerType> RelationshipCustomerTypes) { List <RelationshipCustomerTypeDAO> RelationshipCustomerTypeDAOs = new List <RelationshipCustomerTypeDAO>(); foreach (RelationshipCustomerType RelationshipCustomerType in RelationshipCustomerTypes) { RelationshipCustomerTypeDAO RelationshipCustomerTypeDAO = new RelationshipCustomerTypeDAO(); RelationshipCustomerTypeDAO.Id = RelationshipCustomerType.Id; RelationshipCustomerTypeDAO.Name = RelationshipCustomerType.Name; RelationshipCustomerTypeDAOs.Add(RelationshipCustomerTypeDAO); } await DataContext.BulkMergeAsync(RelationshipCustomerTypeDAOs); return(true); }
public async Task <bool> Update(RelationshipCustomerType RelationshipCustomerType) { RelationshipCustomerTypeDAO RelationshipCustomerTypeDAO = DataContext.RelationshipCustomerType.Where(x => x.Id == RelationshipCustomerType.Id).FirstOrDefault(); if (RelationshipCustomerTypeDAO == null) { return(false); } RelationshipCustomerTypeDAO.Id = RelationshipCustomerType.Id; RelationshipCustomerTypeDAO.Name = RelationshipCustomerType.Name; await DataContext.SaveChangesAsync(); await SaveReference(RelationshipCustomerType); return(true); }