public async Task <bool> Delete(ContractFileGrouping ContractFileGrouping) { await DataContext.ContractFileGrouping.Where(x => x.Id == ContractFileGrouping.Id).UpdateFromQueryAsync(x => new ContractFileGroupingDAO { DeletedAt = StaticParams.DateTimeNow, UpdatedAt = StaticParams.DateTimeNow }); return(true); }
public Contract_ContractFileGroupingDTO(ContractFileGrouping ContractFileGrouping) { this.Id = ContractFileGrouping.Id; this.Title = ContractFileGrouping.Title; this.Description = ContractFileGrouping.Description; this.CreatorId = ContractFileGrouping.CreatorId; this.ContractId = ContractFileGrouping.ContractId; this.FileTypeId = ContractFileGrouping.FileTypeId; this.CreatedAt = ContractFileGrouping.CreatedAt; this.UpdatedAt = ContractFileGrouping.UpdatedAt; this.RowId = ContractFileGrouping.RowId; this.Errors = ContractFileGrouping.Errors; this.Creator = ContractFileGrouping.Creator == null ? null : new Contract_AppUserDTO(ContractFileGrouping.Creator); this.FileType = ContractFileGrouping.FileType == null ? null : new Contract_FileTypeDTO(ContractFileGrouping.FileType); this.ContractFileMappings = ContractFileGrouping.ContractFileMappings?.Select(x => new Contract_ContractFileMappingDTO(x)).ToList(); }
public async Task <bool> Create(ContractFileGrouping ContractFileGrouping) { ContractFileGroupingDAO ContractFileGroupingDAO = new ContractFileGroupingDAO(); ContractFileGroupingDAO.Id = ContractFileGrouping.Id; ContractFileGroupingDAO.Title = ContractFileGrouping.Title; ContractFileGroupingDAO.Description = ContractFileGrouping.Description; ContractFileGroupingDAO.ContractId = ContractFileGrouping.ContractId; ContractFileGroupingDAO.CreatorId = ContractFileGrouping.CreatorId; ContractFileGroupingDAO.FileTypeId = ContractFileGrouping.FileTypeId; ContractFileGroupingDAO.RowId = ContractFileGrouping.RowId; ContractFileGroupingDAO.CreatedAt = StaticParams.DateTimeNow; ContractFileGroupingDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.ContractFileGrouping.Add(ContractFileGroupingDAO); await DataContext.SaveChangesAsync(); ContractFileGrouping.Id = ContractFileGroupingDAO.Id; await SaveReference(ContractFileGrouping); return(true); }
public async Task <bool> Update(ContractFileGrouping ContractFileGrouping) { ContractFileGroupingDAO ContractFileGroupingDAO = DataContext.ContractFileGrouping.Where(x => x.Id == ContractFileGrouping.Id).FirstOrDefault(); if (ContractFileGroupingDAO == null) { return(false); } ContractFileGroupingDAO.Id = ContractFileGrouping.Id; ContractFileGroupingDAO.Title = ContractFileGrouping.Title; ContractFileGroupingDAO.Description = ContractFileGrouping.Description; ContractFileGroupingDAO.ContractId = ContractFileGrouping.ContractId; ContractFileGroupingDAO.CreatorId = ContractFileGrouping.CreatorId; ContractFileGroupingDAO.FileTypeId = ContractFileGrouping.FileTypeId; ContractFileGroupingDAO.RowId = ContractFileGrouping.RowId; ContractFileGroupingDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(ContractFileGrouping); return(true); }
private async Task SaveReference(ContractFileGrouping ContractFileGrouping) { }
public async Task <ContractFileGrouping> Get(long Id) { ContractFileGrouping ContractFileGrouping = await DataContext.ContractFileGrouping.AsNoTracking() .Where(x => x.Id == Id) .Where(x => x.DeletedAt == null) .Select(x => new ContractFileGrouping() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, Title = x.Title, Description = x.Description, ContractId = x.ContractId, CreatorId = x.CreatorId, FileTypeId = x.FileTypeId, RowId = x.RowId, Contract = x.Contract == null ? null : new Contract { Id = x.Contract.Id, Code = x.Contract.Code, Name = x.Contract.Name, TotalValue = x.Contract.TotalValue, ValidityDate = x.Contract.ValidityDate, ExpirationDate = x.Contract.ExpirationDate, DeliveryUnit = x.Contract.DeliveryUnit, InvoiceAddress = x.Contract.InvoiceAddress, InvoiceZipCode = x.Contract.InvoiceZipCode, ReceiveAddress = x.Contract.ReceiveAddress, ReceiveZipCode = x.Contract.ReceiveZipCode, TermAndCondition = x.Contract.TermAndCondition, InvoiceNationId = x.Contract.InvoiceNationId, InvoiceProvinceId = x.Contract.InvoiceProvinceId, InvoiceDistrictId = x.Contract.InvoiceDistrictId, ReceiveNationId = x.Contract.ReceiveNationId, ReceiveProvinceId = x.Contract.ReceiveProvinceId, ReceiveDistrictId = x.Contract.ReceiveDistrictId, ContractTypeId = x.Contract.ContractTypeId, CompanyId = x.Contract.CompanyId, OpportunityId = x.Contract.OpportunityId, OrganizationId = x.Contract.OrganizationId, AppUserId = x.Contract.AppUserId, ContractStatusId = x.Contract.ContractStatusId, CreatorId = x.Contract.CreatorId, CustomerId = x.Contract.CustomerId, CurrencyId = x.Contract.CurrencyId, PaymentStatusId = x.Contract.PaymentStatusId, SubTotal = x.Contract.SubTotal, GeneralDiscountPercentage = x.Contract.GeneralDiscountPercentage, GeneralDiscountAmount = x.Contract.GeneralDiscountAmount, TotalTaxAmountOther = x.Contract.TotalTaxAmountOther, TotalTaxAmount = x.Contract.TotalTaxAmount, Total = x.Contract.Total, }, Creator = x.Creator == null ? null : new AppUser { Id = x.Creator.Id, Username = x.Creator.Username, DisplayName = x.Creator.DisplayName, Address = x.Creator.Address, Email = x.Creator.Email, Phone = x.Creator.Phone, SexId = x.Creator.SexId, Birthday = x.Creator.Birthday, Avatar = x.Creator.Avatar, Department = x.Creator.Department, OrganizationId = x.Creator.OrganizationId, Longitude = x.Creator.Longitude, Latitude = x.Creator.Latitude, StatusId = x.Creator.StatusId, RowId = x.Creator.RowId, Used = x.Creator.Used, }, FileType = x.FileType == null ? null : new FileType { Id = x.FileType.Id, Code = x.FileType.Code, Name = x.FileType.Name, }, }).FirstOrDefaultAsync(); if (ContractFileGrouping == null) { return(null); } return(ContractFileGrouping); }