public IHttpActionResult Put(int id, AnalysisResultModel model) { try { AnalysisResult result = Factory.Create(model); UnitOfWork.AnalysisResults.Update(result, id); UnitOfWork.Commit(); return(Ok(Factory.Create(result))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Analyze(AnalyzeCaseViewModel model) { AnalysisResultModel resultModel = new AnalysisResultModel(); if (ModelState.IsValid) { if (model.IsURL) { if (!AnalyzeHelper.IsURLText(model.Text)) { ModelState.AddModelError("Text", "Please type the URL in correct pattern: http://www.example.com"); return(View(model)); } if (model.IsCheckingNumberOfWords) { resultModel.OccuredWords = _analyzeService.GetWordOccurrencesFromUrl(model.Text); } if (model.IsListingMetaTags) { resultModel.MetaTagWords = _analyzeService.GetMetaTagWordsFromUrl(model.Text); } if (model.IsListingExternalLinks) { resultModel.ExternalLinksList = _analyzeService.GetExternalLinksFromUrl(model.Text); } } else { if (model.IsCheckingNumberOfWords) { resultModel.OccuredWords = _analyzeService.GetWordOccurrencesFromText(model.Text); } if (model.IsListingMetaTags) { resultModel.MetaTagWords = _analyzeService.GetMetaTagWordsFromText(model.Text); } if (model.IsListingExternalLinks) { resultModel.ExternalLinksList = _analyzeService.GetExternalLinksFromText(model.Text); } } } return(PartialView("AnalysisSummary", resultModel)); }