public ActionResult <Vault> AddVault([FromBody] Vault vault) { var id = HttpContext.User.Identity.Name; vault.UserId = id; return(Ok(_repo.AddVault(vault))); }
public ActionResult <Vault> Post([FromBody] Vault Vault) { Vault.UserId = HttpContext.User.Identity.Name; Vault result = _repo.AddVault(Vault); return(Created("api/vaults/" + result.Id, result)); }
public ActionResult <string> Post([FromBody] Vault vault) { vault.UserId = HttpContext.User.Identity.Name; if (vault.UserId != null) { return(Ok(_repo.AddVault(vault))); } return(Unauthorized($"Can not add vault. {vault.Name}")); }
public Vault Post([FromBody] Vault newVualt) { var userId = HttpContext.User.Identity.Name; newVualt.userId = userId; if (ModelState.IsValid) { return(db.AddVault(newVualt)); } return(null); }
public Vault AddVault([FromBody] Vault vault) { if (ModelState.IsValid) { return(_repo.AddVault(vault)); } else { return(null); } }
public ActionResult <Vault> Post([FromBody] Vault vault) { vault.UserId = HttpContext.User.Identity.Name; return(Created("/api/vaults", _vaultRepo.AddVault(vault))); }