public ActionResult <Contractor> Edit(int id, [FromBody] Contractor editedContractor) { try { return(Ok(_contractorsService.Edit(id, editedContractor))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Contractor> Edit([FromBody] Contractor updated, int id) { try { updated.Id = id; return(Ok(_service.Edit(updated))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Contractor> Edit([FromBody] Contractor editContractor, int id) { try { editContractor.Id = id; return(Ok(_cs.Edit(editContractor))); } catch (Exception e) { return(BadRequest(e.Message)); } }
[HttpPut("{contractorsId}")] //EDIT public ActionResult <Contractor> editContractors(string contractorId, Contractor editContractors) { try { editContractors.contractorId = contractorId; return(Ok(_service.Edit(editContractors))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <ActionResult <Contractor> > Edit([FromBody] Contractor updated, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); updated.CreatorId = userInfo.Id; updated.Id = id; return(Ok(_service.Edit(updated))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Contractor> > EditAsync([FromBody] Contractor editData, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); editData.Id = id; editData.CreatorId = userInfo.Id; Contractor editedContractor = _cservice.Edit(editData); return(Ok(editedContractor)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Contractor> > Edit([FromBody] Contractor updated, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); //NOTE attach creatorId so you can validate they are the creator of the original updated.CreatorId = userInfo.Id; updated.Creator = userInfo; updated.Id = id; return(Ok(_service.Edit(updated))); } catch (Exception e) { return(BadRequest(e.Message)); } }