public ActionResult <string> Delete(int id) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_ks.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <string> Delete(int id) { try { string reqUserId = HttpContext.User.FindFirstValue("Id"); User user = _as.GetUserById(reqUserId); return(Ok(_ks.Delete(id, user.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <String> Delete(int id) { try { return(Ok(_ks.Delete(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <string> Delete(int id) { try { return(Ok(_ks.Delete(id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <string> Delete(int id) { try { string userId = findUserInfo(); return(Ok(_ks.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void CanDelete() { Keep keepToDelete = new Keep { Name = "keepToDelete", Id = 1 }; moqKeepsRepository.Setup(repo => repo.GetById(1)).Returns(keepToDelete); moqKeepsRepository.Setup(repo => repo.Delete(1)); var result = keepsService.Delete(1); Assert.AreEqual("Successfully Deleted", result); }
public ActionResult<Keep> Delete(int keepId) { try { // NOTE DONT TRUST THE USER TO TELL YOU WHO THEY ARE!!!! string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return Ok(_ks.Delete(keepId, userId)); } catch (Exception e) { return BadRequest(e.Message); } }
public ActionResult Delete([FromRoute] int id) { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; try { return(Ok(_ks.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <string> > Delete(int id) { try { Profile userinfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_ks.Delete(id, userinfo.Id))); } catch (System.Exception) { return(BadRequest("Cannot Delete")); } }
public async Task <ActionResult <string> > Delete(int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_ks.Delete(id, userInfo.Id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <string> > Delete(int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_keepsService.Delete(id, userInfo))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public ActionResult <string> Delete(int id) { try { var userClaim = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); var userId = userClaim.Value; return(Ok(_ks.Delete(id, userId))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public async Task <ActionResult <Boolean> > Delete(int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); Boolean deleted = _keepsService.Delete(id, userInfo); return(Ok(deleted)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <string> > Delete(int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); Profile foundProfile = _ps.GetOrCreateProfile(userInfo); _ps.deleteKeepCount(foundProfile); return(Ok(_ks.Delete(id, foundProfile.Id))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Keep> Delete(int id) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Please Make Sure You Are Logged In."); } return(Ok(_ks.Delete(user.Value, id))); } catch (Exception e) { return(BadRequest(e.Message)); }; }
public ActionResult <string> Delete(int id) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (userId == null) { throw new Exception("Please Login to Continue!"); } return(Ok(_ks.Delete(userId.Value, id))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <string> Delete(int id) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("You must be logged in to delete any keeps."); } return(Ok(_ks.Delete(user.Value, id))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <Keep> Delete(int id) { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; if (userId == null) { throw new Exception("no id provided..."); } try { return(Ok(_ks.Delete(id, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <string> Delete(int id) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Please log in."); } string userId = user.Value; return(Ok(_ks.Delete(id, userId))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <ActionResult <string> > Delete(int id) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_ks.Delete(id, userInfo.Id))); } catch (NotAuthorized e) { return(StatusCode(StatusCodes.Status403Forbidden, e.Message)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <bool> Delete(int id) { var userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_service.Delete(id, userId))); }