コード例 #1
0
        public IActionResult PostUrl(UrlInputDTO urlInputDTO, int userid)
        {
            StatsDTO s = _usersService.CreateUrl(urlInputDTO, userid);

            if (s == null)
            {
                return(BadRequest());
            }

            return(Created("api/stats/" + s.ID.ToString(), s));
        }
コード例 #2
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));
        }