public StatsDTO CreateUrl(UrlInputDTO urlInputDTO, int userid) { User user = this.GetByID(userid); if (user == null) { return(null); } Url url = _urlService.Create(urlInputDTO.Url, user); return(_statsService.Get(url)); }
public ActionResult <UrlResult> Index(UrlModel urlModel) { var result = urlService.Validate(urlModel); if (result == UrlValidationResult.Malformed) { return(BadRequest()); } if (result == UrlValidationResult.Duplicate) { return(StatusCode(409)); } return(urlService.Create(urlModel)); }