public AdminLogDTO GetById(long id) { using (ZSZDbContext ctx = new ZSZDbContext()) { CommonService <AdminLogEntity> cs = new CommonService <AdminLogEntity>(ctx); AdminLogEntity admin = cs.GetById(id); return(ToDTO(admin)); } }
private AdminLogDTO Entity2DTO(AdminLogEntity adminLogEntity) { return(new AdminLogDTO() { AdminUserId = adminLogEntity.AdminUserId, AdminUserName = adminLogEntity.AdminUser.Name, AdminUserPhoneNum = adminLogEntity.AdminUser.PhoneNum, CreateDateTime = adminLogEntity.CreateDateTime, Id = adminLogEntity.Id, Message = adminLogEntity.Message }); }
private AdminLogDTO ToDTO(AdminLogEntity log) { AdminLogDTO dto = new AdminLogDTO(); dto.AdminUserId = log.AdminUserId; dto.AdminUserName = log.AdminUser.Name; dto.AdminUserPhoneNum = log.AdminUser.PhoneNum; dto.CreateDateTime = log.CreateDateTime; dto.Id = log.Id; dto.Message = log.Message; return(dto); }
public long AddNew(long adminUserId, string message) { using (ZSZDbContext ctx = new ZSZDbContext()) { AdminLogEntity adminLog = new AdminLogEntity(); adminLog.AdminUserId = adminUserId; adminLog.Message = message; ctx.AdminLogs.Add(adminLog); ctx.SaveChanges(); return(adminLog.Id); } }
public AdminLogDTO ToDTO(AdminLogEntity admin) { AdminLogDTO adminDto = new AdminLogDTO(); adminDto.UserId = admin.UserId; adminDto.Msg = admin.Msg; adminDto.UserName = admin.AdminUserEntity.Name; adminDto.UserPhoneNum = admin.AdminUserEntity.PhoneNum; adminDto.CreateDateTime = admin.CreateDateTime; adminDto.Id = admin.Id; return(adminDto); }
public void AddNew(long adminUserId, string message) { using (MyDbContext dbc = new MyDbContext()) { //CommonService<AdminLogEntity> cs = new CommonService<AdminLogEntity>(dbc); AdminLogEntity log = new AdminLogEntity(); log.AdminUserId = adminUserId; log.Message = message; dbc.AdminLogs.Add(log); dbc.SaveChanges(); } }
public void AddAdminLog(long adminUserId, string message) { using (WarmHomeContext db = new WarmHomeContext()) { AdminLogEntity adminLog = new AdminLogEntity() { Msg = message, UserId = adminUserId }; db.AdminLogs.Add(adminLog); } }
public long AddNew(long adminUserId, string ipAddress, string message) { using (MyDbContext dbc = new MyDbContext()) { AdminLogEntity adminLog = new AdminLogEntity(); adminLog.AdminUserId = adminUserId; adminLog.IpAddress = ipAddress; adminLog.Message = message; dbc.AdminLogs.Add(adminLog); dbc.SaveChanges(); return(adminLog.Id); } }
public long AddNew(long adminUserId, string msg) { using (ZSZDbContext ctx = new ZSZDbContext()) { CommonService <AdminLogEntity> cs = new CommonService <AdminLogEntity>(ctx); AdminLogEntity admin = new AdminLogEntity { UserId = adminUserId, Msg = msg }; ctx.AdminLogs.Add(admin); ctx.SaveChanges(); return(admin.Id); } }
public long AddNew(long adminUserId, string message) { using (MyDbContext ctx = new MyDbContext()) { AdminLogEntity log = new AdminLogEntity() { AdminUserId = adminUserId, Msg = message }; ctx.AdminLogs.Add(log); ctx.SaveChanges(); return(log.Id); } }
public AdminLogDTO ToDTO(AdminLogEntity entity) { AdminLogDTO dto = new AdminLogDTO(); dto.AdminId = entity.AdminId; dto.AdminMobile = entity.AdminMobile; dto.CreateTime = entity.CreateTime; dto.Remark = entity.Remark; dto.Id = entity.Id; dto.IpAddress = entity.IpAddress; dto.PermTypeName = entity.PermTypeName; dto.Tip = entity.Tip; return(dto); }
public AdminLogDTO ToDTO(AdminLogEntity entity) { AdminLogDTO dto = new AdminLogDTO(); dto.AdminId = entity.AdminId; dto.AdminMobile = entity.Admin.Mobile; dto.CreateTime = entity.CreateTime; dto.Description = entity.Description; dto.Id = entity.Id; dto.IpAddress = entity.IpAddress; dto.PermissionTypeId = entity.PermissionTypeId; dto.PermissionTypeName = entity.PermissionType.Name; dto.Tip = entity.Tip; return(dto); }
public long Add(long adminId, string permissionType, string description, string ipAddress, string tip) { using (MyDbContext dbc = new MyDbContext()) { long permissionTypeId = dbc.GetAll <PermissionTypeEntity>().SingleOrDefault(p => p.Name == permissionType).Id; AdminLogEntity adminLog = new AdminLogEntity(); adminLog.AdminId = adminId; adminLog.PermissionTypeId = permissionTypeId; adminLog.Description = description; adminLog.IpAddress = ipAddress; adminLog.Tip = tip; dbc.AdminLogs.Add(adminLog); dbc.SaveChanges(); return(adminLog.Id); } }
public async Task <long> AddAsync(long adminId, long permissionTypeId, string description, string ipAddress, string tip) { using (MyDbContext dbc = new MyDbContext()) { AdminLogEntity adminLog = new AdminLogEntity(); adminLog.AdminId = adminId; adminLog.PermissionTypeId = permissionTypeId; adminLog.Description = description; adminLog.IpAddress = ipAddress; adminLog.Tip = tip; dbc.AdminLogs.Add(adminLog); await dbc.SaveChangesAsync(); return(adminLog.Id); } }
public async Task <long> AddAsync(long adminId, string permTypeName, string remark, string ipAddress, string tip) { using (MyDbContext dbc = new MyDbContext()) { AdminLogEntity entity = new AdminLogEntity(); entity.AdminId = adminId; entity.AdminMobile = await dbc.GetStringPropertyAsync <AdminEntity>(a => a.Id == adminId, a => a.Mobile); entity.PermTypeName = permTypeName; entity.Remark = remark; entity.IpAddress = ipAddress; entity.Tip = tip; dbc.AdminLogs.Add(entity); await dbc.SaveChangesAsync(); return(entity.Id); } }
public long AddNew(string message) { AdminLogEntity adminLogEntity = new AdminLogEntity { CreateDateTime = DateTime.Now, OperIp = CommonHelper.GetHostAddress(), Message = message, AdminUserId = int.Parse(HttpContext.Current.Session[Keys.AdminId].ToString()) }; using (YersDbContext ctx = new YersDbContext()) { BaseService <AdminLogEntity> bs = new BaseService <AdminLogEntity>(ctx); ctx.AdminLogs.Add(adminLogEntity); ctx.SaveChanges(); return(adminLogEntity.Id); } }
public long Add(long adminId, string permissionType, string description, string ipAddress, string tip) { using (MyDbContext dbc = new MyDbContext()) { long permissionTypeId = dbc.GetId <PermissionTypeEntity>(p => p.Name == permissionType); if (permissionTypeId <= 0) { return(-1); } AdminLogEntity adminLog = new AdminLogEntity(); adminLog.AdminId = adminId; adminLog.AdminMobile = dbc.GetParameter <AdminEntity>(a => a.Id == adminId, a => a.Mobile); adminLog.PermissionTypeId = permissionTypeId; adminLog.PermissionTypeName = permissionType; adminLog.Description = description; adminLog.IpAddress = ipAddress; adminLog.Tip = tip; dbc.AdminLogs.Add(adminLog); dbc.SaveChanges(); return(adminLog.Id); } }
public long AddNew(long adminUserId, string message) { using (ZSZDbContext ctx = new Service.ZSZDbContext()) { //BaseService<AdminLogEntity> bs = new BaseService<AdminLogEntity>(ctx); /* ctx.AdminUserLogs.Add(new Entities.AdminLogEntity() { * Id = adminUserId, * Message = message * }); * ctx.SaveChanges(); */ AdminLogEntity log = new AdminLogEntity() { AdminUserId = adminUserId, Message = message }; ctx.AdminUserLogs.Add(log); ctx.SaveChanges(); return(log.Id); } }
public static AdminLogDto EntityMap(this AdminLogEntity model) { return(Mapper.Map <AdminLogDto>(model)); }