コード例 #1
0
        public async Task <ActionResult <ContractorJob> > Create([FromBody] ContractorJob newContractorJob)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newContractorJob.CreatorId = userInfo.Id;
                ContractorJob created = _cjs.Create(newContractorJob);
                return(Ok(created));
            }
            catch (System.Exception error)
            {
                return(BadRequest(error.Message));
            }
        }
コード例 #2
0
        public async Task <ActionResult <ContractorJob> > Create([FromBody] ContractorJob newCj)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newCj.CreatorId = userInfo.Id;
                return(Ok(_cjs.Create(newCj)));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.Message));

                throw;
            }
        }