Exemple #1
0
        public IHttpActionResult Post(string link)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(link))
                {
                    return(Content(HttpStatusCode.BadRequest, "Url must have value"));
                }

                bool urlExist = CheckUrlIsExist(link);

                if (urlExist)
                {
                    var token = _appService.AddUrl(link);
                    return(Content(HttpStatusCode.OK, token));
                }
                else
                {
                    return(Content(HttpStatusCode.NotFound, "Url does not exist"));
                }
            }
            catch (Exception ex)
            {
                CustomLogging.LogMessage(TracingLevel.ERROR, ex.Message);
                return(Content(HttpStatusCode.InternalServerError, ex.Message));
            }
        }