コード例 #1
0
        public virtual IActionResult ApiLinkManagerFrameworkSolutionCreateByFrameworkIdBySolutionIdPost([FromRoute][Required] string frameworkId, [FromRoute][Required] string solutionId)
        {
            try
            {
                Guid frameworkIdParsed, solutionIdParsed;
                Guid.TryParse(frameworkId, out frameworkIdParsed);
                Guid.TryParse(solutionId, out solutionIdParsed);

                if (solutionIdParsed == Guid.Empty || frameworkIdParsed == Guid.Empty)
                {
                    throw new CrmApiException("Cannot parse strings into Guids", HttpStatusCode.BadRequest);
                }

                _datastore.FrameworkSolutionAssociate(frameworkIdParsed, solutionIdParsed);
            }
            catch (Crm.CrmApiException ex)
            {
                return(StatusCode((int)ex.HttpStatus, ex.Message));
            }

            return(new ObjectResult(200));
        }
コード例 #2
0
        public virtual IActionResult ApiPorcelainSolutionsExUpdatePut([FromBody] SolutionEx solnEx)
        {
            var solutionFrameworks = new List <Framework>();

            try
            {
                solutionFrameworks = _frameworksDatastore.BySolution(solnEx.Solution.Id.ToString()).ToList();
                _datastore.Update(solnEx);
            }
            catch (Crm.CrmApiException ex)
            {
                return(StatusCode((int)ex.HttpStatus, ex.Message));
            }
            finally
            {
                foreach (var solutionFramework in solutionFrameworks)
                {
                    _linkManagerDatastore.FrameworkSolutionAssociate(solutionFramework.Id, solnEx.Solution.Id);
                }
            }

            return(StatusCode(200, solnEx));
        }