コード例 #1
0
        public async Task <ActionResult <VaultKeep> > CreateVaultKeep([FromBody] VaultKeep newVK)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newVK.CreatorId = userInfo.Id;
                return(Ok(_service.CreateVaultKeep(newVK, userInfo.Id)));
            }
            catch (System.Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #2
0
        public async Task <ActionResult <VaultKeep> > CreateVaultKeep([FromBody] VaultKeep newVaultKeep)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                newVaultKeep.CreatorId = userInfo.Id;
                VaultKeep created = _vks.CreateVaultKeep(newVaultKeep);
                created.Creator = userInfo;
                return(Ok(created));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #3
0
 public ActionResult <VaultKeep> CreateVaultKeep([FromBody] VaultKeep newVaultKeep)
 {
     newVaultKeep.UserId = HttpContext.User.FindFirstValue("Id");
     return(Ok(_service.CreateVaultKeep(newVaultKeep)));
 }