public async Task <bool> Delete(RelationshipCustomerType RelationshipCustomerType) { if (await ValidateId(RelationshipCustomerType)) { } return(RelationshipCustomerType.IsValidated); }
public Store_RelationshipCustomerTypeDTO(RelationshipCustomerType RelationshipCustomerType) { this.Id = RelationshipCustomerType.Id; this.Name = RelationshipCustomerType.Name; this.Errors = RelationshipCustomerType.Errors; }
public async Task <RelationshipCustomerType> Get(long Id) { RelationshipCustomerType RelationshipCustomerType = await UOW.RelationshipCustomerTypeRepository.Get(Id); if (RelationshipCustomerType == null) { return(null); } return(RelationshipCustomerType); }
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> 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); }
public async Task <RelationshipCustomerType> Get(long Id) { RelationshipCustomerType RelationshipCustomerType = await DataContext.RelationshipCustomerType.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new RelationshipCustomerType() { Id = x.Id, Name = x.Name, }).FirstOrDefaultAsync(); if (RelationshipCustomerType == null) { return(null); } return(RelationshipCustomerType); }
public async Task <bool> ValidateId(RelationshipCustomerType RelationshipCustomerType) { RelationshipCustomerTypeFilter RelationshipCustomerTypeFilter = new RelationshipCustomerTypeFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = RelationshipCustomerType.Id }, Selects = RelationshipCustomerTypeSelect.Id }; int count = await UOW.RelationshipCustomerTypeRepository.Count(RelationshipCustomerTypeFilter); if (count == 0) { RelationshipCustomerType.AddError(nameof(RelationshipCustomerTypeValidator), nameof(RelationshipCustomerType.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <RelationshipCustomerType> Update(RelationshipCustomerType RelationshipCustomerType) { if (!await RelationshipCustomerTypeValidator.Update(RelationshipCustomerType)) { return(RelationshipCustomerType); } try { var oldData = await UOW.RelationshipCustomerTypeRepository.Get(RelationshipCustomerType.Id); await UOW.Begin(); await UOW.RelationshipCustomerTypeRepository.Update(RelationshipCustomerType); await UOW.Commit(); RelationshipCustomerType = await UOW.RelationshipCustomerTypeRepository.Get(RelationshipCustomerType.Id); await Logging.CreateAuditLog(RelationshipCustomerType, oldData, nameof(RelationshipCustomerTypeService)); return(RelationshipCustomerType); } catch (Exception ex) { await UOW.Rollback(); if (ex.InnerException == null) { await Logging.CreateSystemLog(ex, nameof(RelationshipCustomerTypeService)); throw new MessageException(ex); } else { await Logging.CreateSystemLog(ex.InnerException, nameof(RelationshipCustomerTypeService)); throw new MessageException(ex.InnerException); } } }
public Store_StoreRelationshipCustomerMappingDTO(StoreRelationshipCustomerMapping StoreRelationshipCustomerMapping) { this.StoreId = StoreRelationshipCustomerMapping.StoreId; this.RelationshipCustomerTypeId = StoreRelationshipCustomerMapping.RelationshipCustomerTypeId; this.RelationshipCustomerType = StoreRelationshipCustomerMapping.RelationshipCustomerType; }
public async Task <bool> Create(RelationshipCustomerType RelationshipCustomerType) { return(RelationshipCustomerType.IsValidated); }
private async Task SaveReference(RelationshipCustomerType RelationshipCustomerType) { }
public async Task <bool> Delete(RelationshipCustomerType RelationshipCustomerType) { await DataContext.RelationshipCustomerType.Where(x => x.Id == RelationshipCustomerType.Id).DeleteFromQueryAsync(); return(true); }