public Store_StoreRepresentDTO(StoreRepresent StoreRepresent) { this.Id = StoreRepresent.Id; this.Name = StoreRepresent.Name; this.DateOfBirth = StoreRepresent.DateOfBirth; this.Phone = StoreRepresent.Phone; this.Email = StoreRepresent.Email; this.PositionId = StoreRepresent.PositionId; this.StoreId = StoreRepresent.StoreId; this.Position = StoreRepresent.Position == null ? null : new Store_PositionDTO(StoreRepresent.Position); this.Store = StoreRepresent.Store == null ? null : new Store_StoreDTO(StoreRepresent.Store); this.Errors = StoreRepresent.Errors; }
public async Task <bool> Create(StoreRepresent StoreRepresent) { StoreRepresentDAO StoreRepresentDAO = new StoreRepresentDAO(); StoreRepresentDAO.Id = StoreRepresent.Id; StoreRepresentDAO.Name = StoreRepresent.Name; StoreRepresentDAO.DateOfBirth = StoreRepresent.DateOfBirth; StoreRepresentDAO.Phone = StoreRepresent.Phone; StoreRepresentDAO.Email = StoreRepresent.Email; StoreRepresentDAO.PositionId = StoreRepresent.PositionId; StoreRepresentDAO.StoreId = StoreRepresent.StoreId; DataContext.StoreRepresent.Add(StoreRepresentDAO); await DataContext.SaveChangesAsync(); StoreRepresent.Id = StoreRepresentDAO.Id; await SaveReference(StoreRepresent); return(true); }
public async Task <bool> Update(StoreRepresent StoreRepresent) { StoreRepresentDAO StoreRepresentDAO = DataContext.StoreRepresent.Where(x => x.Id == StoreRepresent.Id).FirstOrDefault(); if (StoreRepresentDAO == null) { return(false); } StoreRepresentDAO.Id = StoreRepresent.Id; StoreRepresentDAO.Name = StoreRepresent.Name; StoreRepresentDAO.DateOfBirth = StoreRepresent.DateOfBirth; StoreRepresentDAO.Phone = StoreRepresent.Phone; StoreRepresentDAO.Email = StoreRepresent.Email; StoreRepresentDAO.PositionId = StoreRepresent.PositionId; StoreRepresentDAO.StoreId = StoreRepresent.StoreId; await DataContext.SaveChangesAsync(); await SaveReference(StoreRepresent); return(true); }
private async Task SaveReference(StoreRepresent StoreRepresent) { }
public async Task <bool> Delete(StoreRepresent StoreRepresent) { await DataContext.StoreRepresent.Where(x => x.Id == StoreRepresent.Id).DeleteFromQueryAsync(); return(true); }
public async Task <StoreRepresent> Get(long Id) { StoreRepresent StoreRepresent = await DataContext.StoreRepresent.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new StoreRepresent() { Id = x.Id, Name = x.Name, DateOfBirth = x.DateOfBirth, Phone = x.Phone, Email = x.Email, PositionId = x.PositionId, StoreId = x.StoreId, Position = x.Position == null ? null : new Position { Id = x.Position.Id, Code = x.Position.Code, Name = x.Position.Name, StatusId = x.Position.StatusId, RowId = x.Position.RowId, Used = x.Position.Used, }, Store = x.Store == null ? null : new Store { Id = x.Store.Id, Code = x.Store.Code, CodeDraft = x.Store.CodeDraft, Name = x.Store.Name, UnsignName = x.Store.UnsignName, ParentStoreId = x.Store.ParentStoreId, OrganizationId = x.Store.OrganizationId, StoreTypeId = x.Store.StoreTypeId, StoreGroupingId = x.Store.StoreGroupingId, Telephone = x.Store.Telephone, ProvinceId = x.Store.ProvinceId, DistrictId = x.Store.DistrictId, WardId = x.Store.WardId, Address = x.Store.Address, UnsignAddress = x.Store.UnsignAddress, DeliveryAddress = x.Store.DeliveryAddress, Latitude = x.Store.Latitude, Longitude = x.Store.Longitude, DeliveryLatitude = x.Store.DeliveryLatitude, DeliveryLongitude = x.Store.DeliveryLongitude, OwnerName = x.Store.OwnerName, OwnerPhone = x.Store.OwnerPhone, OwnerEmail = x.Store.OwnerEmail, TaxCode = x.Store.TaxCode, LegalEntity = x.Store.LegalEntity, AppUserId = x.Store.AppUserId, StatusId = x.Store.StatusId, RowId = x.Store.RowId, Used = x.Store.Used, StoreStatusId = x.Store.StoreStatusId, }, }).FirstOrDefaultAsync(); if (StoreRepresent == null) { return(null); } return(StoreRepresent); }