Пример #1
0
        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));
        }
Пример #2
0
        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));
        }