// GET: Home public IActionResult Index() { try { AdminPanelViewModel model = new AdminPanelViewModel { Malware = malwareManager.GetAll().Select(e => new CORE.Malware { Id = e.Id, }).ToList(), ScreenShot = screenShotManager.GetAll().Select(e => new CORE.ScreenShot { Id = e.Id, }).ToList(), Comment = commentManager.GetAll().Select(e => new CORE.Comment { Id = e.Id, }).ToList(), User = _userManager.Users.Select(e => new CORE.ApplicationUser { Id = e.Id, }).ToList() }; return(View(model)); } catch (Exception ex) { //guardamso log si se produce una excepcion _log.LogError(ex.Message, ex); return(View()); } }
/// <summary> /// Metodo que carga los comentario en la vista principal /// </summary> /// <returns>vista</returns> public IActionResult Index() { try { //obtenemos lso comentarios y los pasamos como modelo a la vista var model = commentManager.GetAll().ToList(); return(View(model)); } catch (Exception ex) { //guardamso log si se produce una excepcion _log.LogError(ex.Message, ex); return(View()); } }
public IActionResult MyComments() { try { var model = commentManager.GetAll().Where(e => e.User_Id == User.FindFirstValue(ClaimTypes.NameIdentifier)).ToList(); if (model != null) { return(View(model)); } else { return(View()); } } catch (Exception ex) { _logger.LogError(ex.Message, ex); return(RedirectToAction("Index")); } }
/// <summary> /// metodo que devuelve la vista con los detalles del malware /// </summary> /// <param name="id">md5 del malware</param> /// <returns>vista</returns> public IActionResult Index(string id) { try { //revisamos que el parametro no este vacio if (id != null) { //desde el parametro obetenmos el malware asociaso var malware = malwareManager.GetByMd5(id); malId = malware.Id; if (malware != null) { if (malware.MalwareStatus != CORE.Status.Finalizado) { return(RedirectToAction("Status", malware)); } //creamos el modelo de datos de la vista AnalysisIndexViewModel model = new AnalysisIndexViewModel { Malware = malwareManager.GetAll().Where(p => p.MD5 == id).Select(e => new CORE.Malware { Id = malware.Id, User_Id = malware.User_Id, Date = malware.Date, MD5 = malware.MD5, SHA256 = malware.SHA256, FileName = malware.FileName, FilePath = malware.FilePath, Name = malware.Name, MalwareLevel = malware.MalwareLevel, MalwareStatus = malware.MalwareStatus, Url = malware.Url }).FirstOrDefault(), Screenshots = screenShotManager.GetAll().Where(p => p.Malware_Id == malware.Id).Select(e => new CORE.ScreenShot { Id = e.Id, Malware_Id = e.Malware_Id, PathFile = e.PathFile, }).ToList(), Comments = commentManager.GetAll().Where(c => c.Malware_Id == malware.Id).Select(e => new CORE.Comment { Id = e.Id, User = e.User, User_Id = e.User_Id, Malware_Id = e.Malware_Id, TextComment = e.TextComment, }).ToList(), VTInfo = virusTotalManager.GetAll().Where(v => v.Malware_Id == malware.Id).Select(e => new CORE.VirusTotal.VirusTotalInfo { Id = e.Id, Malware_Id = e.Malware_Id, Positives = e.Positives, Total = e.Total, MD5 = e.MD5 }).SingleOrDefault(), CuckooInfo = cuckooInfoManager.GetAll().Where(v => v.Malware_Id == malware.Id).Select(e => new CORE.Cuckoo.CuckooInfo { Id = e.Id, Malware = e.Malware, Malware_Id = e.Malware_Id, Score = e.Score, Package = e.Package, Category = e.Category, MD5 = e.MD5 }).SingleOrDefault(), TCInfo = threatCrowdInfoManager.GetAll().Where(v => v.Malware_Id == malware.Id).Select(e => new CORE.ThreatCrowd.ThreatCrowdInfo { Id = e.Id, Malware_Id = e.Malware_Id, Type = e.Type, Votes = e.Votes, Permalink = e.Permalink }).SingleOrDefault(), }; // devolvemos la vista con el modelo de datos return(View(model)); } else { // return(RedirectToAction("Error")); } } else { //TODO return(RedirectToAction("Index", "Malware")); } } catch (Exception ex) { //guardamso log si se produce una excepcion _log.LogError(ex.Message, ex); return(RedirectToAction("Index", "Malware")); } }
public IActionResult GetAll(int id) { var json = commentManager.GetAll(); return(Ok(json)); }
public IEnumerable <Comment> Get() { return(_commentManager.GetAll()); }