public ActionResult <Keep> Put([FromBody] Keep editedKeep, int Id) { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; editedKeep.UserId = userId; return(Ok(_ks.Edit(editedKeep))); }
public ActionResult <Keep> Edit(int id, [FromBody] Keep editKeep) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; editKeep.Id = id; return(Ok(_ks.Edit(editKeep, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep newKeep, int id) { try { newKeep.Id = id; string reqUserId = HttpContext.User.FindFirstValue("Id"); User user = _as.GetUserById(reqUserId); return(Ok(_ks.Edit(newKeep, user.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit(int id, [FromBody] Keep keepToUpdate) { keepToUpdate.Id = id; try { return(Ok(_ks.Edit(keepToUpdate))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep editKeep, int id) { try { // id = editKeep.Id; return(Ok(_ks.Edit(editKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep update, int id) { try { update.Id = id; return(Ok(_ks.Edit(update))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep update, int id) { try { update.Id = id; return(_ks.Edit(update, HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit(int id, [FromBody] Keep keepUpdate) { try { keepUpdate.Id = id; string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_ks.Edit(keepUpdate, userId))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Keep> EditKeep([FromBody] Keep KeepData) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; KeepData.UserId = userId; return(Ok(_ks.Edit(KeepData))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Put([FromBody] Keep editedKeep, int id) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; editedKeep.UserId = userId; return(Ok(_ks.Edit(editedKeep, id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep newKeep, int id) { try { string userId = findUserInfo(); newKeep.Id = id; return(Ok(_ks.Edit(newKeep, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit(int id, [FromBody] Keep updatedKeep) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; updatedKeep.UserId = userId; return(Ok(_ks.Edit(id, updatedKeep))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep newKeep, int id) { try { newKeep.Id = id; newKeep.UserId = HttpContext.User.FindFirstValue("Id"); return(Ok(_ks.Edit(newKeep))); } catch (Exception e) { return(Unauthorized(e.Message)); } }
public async Task <ActionResult <Keep> > Edit([FromBody] Keep updatedKeep, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_keepsServ.Edit(updatedKeep, userInfo.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult<Keep> Edit(int keepId, [FromBody] Keep updatedKeep) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; updatedKeep.UserId = userId; updatedKeep.Id = keepId; return Ok(_ks.Edit(updatedKeep)); } catch (Exception e) { return BadRequest(e.Message); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromQuery] Keep updated) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); updated.Id = id; return(Ok(_ks.Edit(updated, userInfo))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep editedKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); editedKeep.Id = id; return(Ok(_keepsService.Edit(editedKeep, userInfo))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep editKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); editKeep.Id = id; return(Ok(_ks.Edit(editKeep, userInfo.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep keep) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; keep.UserId = userId; return(Ok(_ks.Edit(keep))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
async public Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep keepBody) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); keepBody.Id = id; Keep updatedKeep = _service.Edit(keepBody, userInfo.Id); return(Ok(updatedKeep)); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public ActionResult <Keep> Edit(int id, [FromBody] Keep updatedKeep) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; // NOTE DONT TRUST THE USER TO TELL YOU WHO THEY ARE!!!! updatedKeep.UserId = userId; updatedKeep.Id = id; return(Ok(_ks.Edit(updatedKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep editData) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); //helpful to check in service if creator is whoever is logged in editData.Id = id; return(Ok(_ks.Edit(editData, userInfo.Id))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep editData) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); editData.Id = id; editData.Creator = userInfo; editData.CreatorId = userInfo.Id; return(Ok(_kService.Edit(editData, userInfo.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > Edit([FromBody] Keep updated, int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); updated.CreatorId = userInfo.Id; updated.Creator = userInfo; updated.Id = id; return(Ok(_service.Edit(updated))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > Edit([FromBody] Keep payload, int id) { try { Profile user = await HttpContext.GetUserInfoAsync <Profile>(); payload.CreatorId = user.Id; payload.Creator = user; payload.Id = id; return(Ok(_serv.Edit(payload))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <Keep> > EditAsync(int id, [FromBody] Keep keep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); keep.Id = id; keep.CreatorId = userInfo.Id; keep.Creator = userInfo; return(Ok(_kService.Edit(keep, userInfo.Id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Keep> Edit(int id, [FromBody] Keep updatedKeep) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Must be logged in to edit"); } return(Ok(_ks.Edit(id, updatedKeep))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <ActionResult <Keep> > Edit(int id, [FromBody] Keep editKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); editKeep.CreatorId = userInfo.Id; editKeep.Creator = userInfo; editKeep.Id = id; return(Ok(_service.Edit(editKeep, userInfo.Id))); } catch (System.Exception) { throw; } }
public ActionResult <Keep> Edit([FromBody] Keep newKeep, int id) { try { Claim userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (newKeep.UserId != userId.Value) { throw new Exception("You can only edit your keeps"); } newKeep.Id = id; return(Ok(_ks.Edit(newKeep, userId.Value))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Edit([FromBody] Keep keepToUpdate) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Please log in."); } string userId = user.Value; return(Ok(_ks.Edit(keepToUpdate, userId))); } catch (System.Exception) { throw; } }