public AttachmentService(PublicContext publicContext, IAttachmentPathProvider attachmentPathProvider, IPreviewGeneratorService previewGeneratorService, IHttpContextAccessor httpContext) { _publicContext = publicContext; _attachmentPathProvider = attachmentPathProvider; _previewGeneratorService = previewGeneratorService; _httpContext = httpContext; }
public IEnumerable <Publicacion> Get() { using (var context = new PublicContext()) { return(context.Publicaciones.ToList()); } }
public static int IsPostOrComment(this PublicContext context, int id) { using (IDbConnection db = context.Connection) { return(db.Query <int>("SELECT ispostorcomment(@id)", new { id }).FirstOrDefault()); } }
public static Comment AddComment(this PublicContext context, Comment comment) { using (IDbConnection db = context.Connection) { return(db.Query <Comment>("SELECT * from public.createcomment(@postId, @text, @userId)", new { comment.PostId, comment.Text, comment.UserId }).FirstOrDefault()); } }
public static async Task <List <OutDeviceStatus> > Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, ILogger log) { if (req.Query.ContainsKey("compname") && req.Query.ContainsKey("osname")) { var compname = req.Query["compname"]; var osname = req.Query["osname"]; var a = Environment.GetEnvironmentVariable("databaseconnectionstring"); var context = new PublicContext(Environment.GetEnvironmentVariable("databaseconnectionstring")); var deviceService = new DeviceService(context); var hystory = await deviceService.GetOnlineHystoryDevice(compname, osname); var mapperConfig = new MapperConfiguration(mc => { mc.AddProfile(new MapperProfile()); }); IMapper mapper = mapperConfig.CreateMapper(); return(mapper.Map <List <OutDeviceStatus> >(hystory)); } else { throw new Exception("compname or osname is absend"); } }
/*** ** Advice = Event + Observation ** Event = Fundort ** Observation = Fund ** Observation = ObservationInfo + optional List of Images ***/ public AdviceController(UserManager <ApplicationUser> userManager, DeterminationContext detContext, InformationContext infContext, ObservationContext obsContext, MappingContext mapContext, LocationContext locContext, PublicContext idoContext) { _userManager = userManager; _obsContext = obsContext; _locContext = locContext; _idoContext = idoContext; }
public Publicacion Get(int id) { using (var context = new PublicContext()) { return(context.Publicaciones.FirstOrDefault(x => x.Id == id)); } }
public ApplicationUserController(UserManager <ApplicationUser> userManager, IOptions <ApplicationSettings> appSettings, PublicContext idoContext, ObservationContext obsContext, IConfiguration smtpConfiguration) { _smtpConfig = smtpConfiguration; _userManager = userManager; _appSettings = appSettings.Value; _idoContext = idoContext; _obsContext = obsContext; }
public CommentService(PublicContext publicContext, IUserInputService userInputService, IServiceProvider serviceProvider, IRequestLifetimeService requestLifetimeService, IHttpContextAccessor httpContext) { _context = publicContext; _userInputService = userInputService; _serviceProvider = serviceProvider; _requestLifetimeService = requestLifetimeService; _httpContext = httpContext; }
public PostService(PublicContext publicContext, IUserInputService userInputSanitizeService, IRequestLifetimeService requestLifetimeService, IHttpContextAccessor httpContext) { _context = publicContext; _userInputService = userInputSanitizeService; _requestLifetimeService = requestLifetimeService; _httpContext = httpContext; }
public bool Delete(int id) { using (var context = new PublicContext()) { var publicacionEliminar = context.Publicaciones.FirstOrDefault(x => x.Id == id); context.Publicaciones.Remove(publicacionEliminar); context.SaveChanges(); return(true); } }
public Publicacion Put(Publicacion publicacion) { using (var context = new PublicContext()) { var publicacionActualizar = context.Publicaciones.FirstOrDefault(x => x.Id == publicacion.Id); publicacionActualizar.Descripcion = publicacion.Descripcion; publicacionActualizar.EsPrivada = publicacion.EsPrivada; context.SaveChanges(); return(publicacion); } }
public UserInputService(PublicContext publicContext, ISettingService settingService, IHtmlSanitizer htmlSanitizer, IServiceProvider serviceProvider) { _publicContext = publicContext; _settingService = settingService; _htmlSanitizer = htmlSanitizer; _htmlSanitizer.AllowedCssProperties.Clear(); _htmlSanitizer.AllowedCssClasses.Clear(); var pipeline = new MarkdownPipelineBuilder(); var blockQuoteParser = pipeline.BlockParsers.Find <QuoteBlockParser>(); if (blockQuoteParser != null) { pipeline.BlockParsers.Remove(blockQuoteParser); } /*var paragraphRenderer = pipeline.BlockParsers.Find<ParagraphBlockParser>(); * if (paragraphRenderer != null) * pipeline.BlockParsers.Remove(paragraphRenderer);*/ pipeline = pipeline //.UseMediaLinks() .UseEmojiAndSmiley() .UseAutoLinks() .UseGreenText() .UseEmphasisExtras() .UseLinkTo(serviceProvider) .UseMyEmphasis() .UseSoftlineBreakAsHardlineBreak(); //.DisableHtml() pipeline.Extensions.Add(new MyParagraphExtension()); _pipeline = pipeline.Build(); //pipeline.BlockParsers.Remove(QuoteBlockParser) //pipeline.BlockParsers.Tr(); //pipeline.BlockParsers.TryRemove<HtmlBlockParser>(); //pipeline.InlineParsers.TryRemove<HtmlEntityParser>(); // pipeline.InlineParsers.TryRemove<CodeInlineParser>(); //pipeline.InlineParsers.TryRemove<AutolineInlineParser>(); _jsonWriter = new JsonSerializer { NullValueHandling = (NullValueHandling)1 }; }
public IHttpActionResult Post(Publicacion publicacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } using (var context = new PublicContext()) { context.Publicaciones.Add(publicacion); context.SaveChanges(); return(Ok(publicacion)); } }
public RegistrationService(PublicContext publicContext, IHttpContextAccessor httpContextAccessor, IMailClient mailClient, IPasswordHasherService passwordHasherService) { _publicContext = publicContext; _httpContextAccessor = httpContextAccessor; _mailClient = mailClient; _passwordHasherService = passwordHasherService; _hasNumber = new Regex(@"[0-9]+", RegexOptions.Compiled | RegexOptions.IgnoreCase); _hasUpperChar = new Regex(@"[A-Z]+", RegexOptions.Compiled | RegexOptions.IgnoreCase); _hasMinimum8Chars = new Regex(@".{8,}", RegexOptions.Compiled | RegexOptions.IgnoreCase); _emailRegex = new Regex(@"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])", RegexOptions.Compiled | RegexOptions.IgnoreCase); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); var deviceInfo = JsonConvert.DeserializeObject <DeviceInfo>(requestBody); var a = Environment.GetEnvironmentVariable("databaseconnectionstring"); var context = new PublicContext(Environment.GetEnvironmentVariable("databaseconnectionstring")); var deviceService = new DeviceService(context); var device = await deviceService.GetDevice(deviceInfo.compname, deviceInfo.osname); if (device != null) { await deviceService.UpdateDevice(device.Id, deviceInfo); } else { await deviceService.AddDevice(deviceInfo); } return(new OkObjectResult("{\"status\": \"Ok\"}")); }
public AddressRepository(PublicContext peoplecontext) { db = peoplecontext; }
public BoardService(PublicContext publicContext) { _publicContext = publicContext; }
public GameService(PublicContext publicContext) { context = publicContext; }
public ClientRepository(PublicContext peoplecontext) { db = peoplecontext; }
public DepartmentRepository(PublicContext peoplecontext) { db = peoplecontext; }
public StatusRepository(PublicContext peoplecontext) { db = peoplecontext; }
public ScheduleRepository(PublicContext peoplecontext) { db = peoplecontext; }
public AuthenticationService(PublicContext publicContext, IPasswordHasherService passwordHasherService) { _context = publicContext; _passwordHasherService = passwordHasherService; }
public RegisterServiceTelegram(string t, PublicContext publicContext) { context = publicContext; token = t; }
public ClientTypeOfServiceRepository(PublicContext peoplecontext) { db = peoplecontext; }
public ReactionService(PublicContext publicContext) { _context = publicContext; }
public UnitOfWork(PublicContext context) { db = context; }
public TelegramProviderResolver(string t, PublicContext publicContext) { context = publicContext; token = t; }
public ServiceRepository(PublicContext peoplecontext) { db = peoplecontext; }