public async Task <bool> Create(AuditLogProperty AuditLogProperty) { AuditLogPropertyDAO AuditLogPropertyDAO = new AuditLogPropertyDAO(); AuditLogPropertyDAO.Id = AuditLogProperty.Id; AuditLogPropertyDAO.AppUserId = AuditLogProperty.AppUserId; AuditLogPropertyDAO.Property = AuditLogProperty.Property; AuditLogPropertyDAO.OldValue = AuditLogProperty.OldValue; AuditLogPropertyDAO.NewValue = AuditLogProperty.NewValue; AuditLogPropertyDAO.ClassName = AuditLogProperty.ClassName; AuditLogPropertyDAO.ActionName = AuditLogProperty.ActionName; AuditLogPropertyDAO.Time = AuditLogProperty.Time; DataContext.AuditLogProperty.Add(AuditLogPropertyDAO); await DataContext.SaveChangesAsync(); AuditLogPropertyDAO.Id = AuditLogPropertyDAO.Id; await SaveReference(AuditLogPropertyDAO); return(true); }
public async Task <bool> Update(AuditLogProperty AuditLogProperty) { AuditLogPropertyDAO AuditLogPropertyDAO = DataContext.AuditLogProperty.Where(x => x.Id == AuditLogProperty.Id).FirstOrDefault(); if (AuditLogPropertyDAO == null) { return(false); } AuditLogPropertyDAO.Id = AuditLogProperty.Id; AuditLogPropertyDAO.AppUserId = AuditLogProperty.AppUserId; AuditLogPropertyDAO.Property = AuditLogProperty.Property; AuditLogPropertyDAO.OldValue = AuditLogProperty.OldValue; AuditLogPropertyDAO.NewValue = AuditLogProperty.NewValue; AuditLogPropertyDAO.ClassName = AuditLogProperty.ClassName; AuditLogPropertyDAO.ActionName = AuditLogProperty.ActionName; AuditLogPropertyDAO.Time = AuditLogProperty.Time; await DataContext.SaveChangesAsync(); await SaveReference(AuditLogPropertyDAO); return(true); }
public async Task <AuditLogProperty> Get(long Id) { AuditLogProperty AuditLogProperty = await DataContext.AuditLogProperty.AsNoTracking() .Where(x => x.Id == Id).Select(x => new AuditLogProperty() { Id = x.Id, AppUserId = x.AppUserId, Property = x.Property, OldValue = x.OldValue, NewValue = x.NewValue, ClassName = x.ClassName, ActionName = x.ActionName, Time = x.Time, AppUser = x.AppUser == null ? null : new AppUser { Id = x.AppUser.Id, Username = x.AppUser.Username, DisplayName = x.AppUser.DisplayName, Address = x.AppUser.Address, Email = x.AppUser.Email, Phone = x.AppUser.Phone, SexId = x.AppUser.SexId, Birthday = x.AppUser.Birthday, Avatar = x.AppUser.Avatar, Department = x.AppUser.Department, OrganizationId = x.AppUser.OrganizationId, Longitude = x.AppUser.Longitude, Latitude = x.AppUser.Latitude, StatusId = x.AppUser.StatusId, }, }).FirstOrDefaultAsync(); if (AuditLogProperty == null) { return(null); } return(AuditLogProperty); }
public async Task <bool> Delete(AuditLogProperty AuditLogProperty) { await DataContext.AuditLogProperty.Where(x => x.Id == AuditLogProperty.Id).DeleteFromQueryAsync(); return(true); }