public override LogDto GetById(Guid Id)
 {
     using (UnitOfMongo op = new UnitOfMongo())
     {
         NoSQLLogEntity entity = op.Query <NoSQLLogEntity>().Where(x => x.Id.Equals(Id)).FirstOrDefault();
         return(ConvertEntityToDto(entity));
     }
 }
 public override void Delete(LogDto dto)
 {
     using (UnitOfMongo op = new UnitOfMongo())
     {
         NoSQLLogEntity entity = op.Query <NoSQLLogEntity>().Where(x => x.Id.Equals(dto.Id)).FirstOrDefault();
         if (entity != null)
         {
             op.Delete(entity);
         }
     }
 }
        internal static LogDto ConvertEntityToDto(NoSQLLogEntity entity)
        {
            LogDto result = new LogDto();

            if (entity != null)
            {
                result.Id  = entity.Id;
                result.App = new AppDto {
                    Id = entity.AppId, Name = entity.AppName
                };
                result.Level   = entity.Level;
                result.LogDate = entity.LogDate;
                result.Message = entity.Message;
            }
            return(result);
        }
 public override void Save(LogDto dto)
 {
     using (UnitOfMongo op = new UnitOfMongo())
     {
         NoSQLLogEntity entity = op.Query <NoSQLLogEntity>().Where(x => x.Id.Equals(dto.Id)).FirstOrDefault();
         if (entity == null)
         {
             entity = new NoSQLLogEntity();
         }
         entity.AppId   = dto.App.Id;
         entity.AppName = dto.App.Name;
         entity.Level   = dto.Level;
         entity.LogDate = dto.LogDate;
         entity.Message = dto.Message;
         op.SaveOrUpdate(entity);
     }
 }