Beispiel #1
0
 public void Put([FromBody] Vault vault)
 {
     if (vault.UserId == HttpContext.User.Identity.Name)
     {
         _repo.Update(vault);
     }
     else
     {
         throw new Exception("Not authorized to edit another user's vault");
     }
 }
Beispiel #2
0
 public ActionResult <Keep> Put(int id, [FromBody] Keep value)
 {
     try
     {
         value.id = id;
         return(Ok(_repo.Update(value)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
 public ActionResult <Vault> Put(int id, [FromBody] Vault data)
 {
     try
     {
         data.Id = id;
         return(Ok(_repo.Update(data)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Beispiel #4
0
 public ActionResult <Vault> Put(int id, [FromBody] Vault value)
 {
     try
     {
         var Userid = HttpContext.User.FindFirstValue("Id");
         value.Id     = id;
         value.UserId = Userid;
         return(Ok(_repo.Update(value)));
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("hits put");
         return(BadRequest(e));
     }
 }
Beispiel #5
0
 public Vault Put([FromBody] Vault vault)
 {
     return(_repo.Update(vault));
 }