Example #1
0
        public async Task <IHttpActionResult> PostAsync([FromBody] SourcePointForm sourcePointAdded)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid posted data."));
            }

            try
            {
                var sourcePoint = _mapper.Map <SourcePoint>(sourcePointAdded);
                var catalogName = HttpUtility.UrlDecode(sourcePointAdded.CatalogName);
                var documentId  = HttpUtility.UrlDecode(sourcePointAdded.DocumentId);
                return(Ok(await _sourceService.AddSourcePointAsync(catalogName, documentId, sourcePoint)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }