public ActionResult <Contractor> Create([FromBody] Contractor newContractor)
 {
     try
     {
         return(Ok(_service.Create(newContractor)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
예제 #2
0
 public ActionResult <Contractor> Create([FromBody] Contractor newContractor)
 {
     try
     {
         return(Ok(_contractorsService.Create(newContractor)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
        public async Task <ActionResult <Contractor> > Create([FromBody] Contractor newCon)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newCon.CreatorId = userInfo.Id;
                return(Ok(_service.Create(newCon)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
예제 #4
0
        public async Task <ActionResult <Contractor> > CreateAsync([FromBody] Contractor newContractor)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newContractor.CreatorId = userInfo.Id;
                Contractor created = _cservice.Create(newContractor);

                return(Ok(created));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.Message));
            }
        }