public ActionResult <VaultKeep> Create([FromBody] VaultKeep newRelation) { try { return(_vks.Create(newRelation, HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <DTOVaultKeep> Create([FromBody] DTOVaultKeep newVaultKeep) { try { newVaultKeep.UserId = findUserInfo(); return(Ok(_vks.Create(newVaultKeep))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep vaultKeep) { try { string userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_vks.Create(vaultKeep, userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> create([FromBody] VaultKeep vaultKeep) { try { vaultKeep.UserId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(_vks.Create(vaultKeep)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <DTOVaultedKeep> Post([FromBody] DTOVaultedKeep newDTOVK) { try { newDTOVK.UserId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_vks.Create(newDTOVK))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task<ActionResult<VaultKeep>> CreateAsync([FromBody] VaultKeep newVK) { try { Profile userInfo = await HttpContext.GetUserInfoAsync<Profile>(); newVK.CreatorId = userInfo.Id; return Ok(_vkserv.Create(newVK)); } catch (System.Exception err) { return BadRequest(err.Message); } }
public ActionResult <String> Create([FromBody] VaultKeep newData) { try { newData.UserId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; _vks.Create(newData); return(Ok("Success")); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep newVaultKeep) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; newVaultKeep.UserId = userId; return(Ok(_vks.Create(newVaultKeep))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep newVKeep) { string reqUserId = HttpContext.User.FindFirstValue("Id"); User user = _as.GetUserById(reqUserId); newVKeep.UserId = user.Id; //Check if vault is owned by user newVKeep.VaultId = _vs.Get(newVKeep.VaultId, newVKeep.UserId).Id; //Check if keep exists newVKeep.KeepId = _ks.Get(newVKeep.KeepId).Id; //Post to vk repo return(Ok(_vks.Create(newVKeep))); }
public ActionResult <VaultKeep> Post([FromBody] VaultKeep newVaultKeep) { try { string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; newVaultKeep.UserId = userId; return(Ok(_vs.Create(newVaultKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Post([FromBody] VaultKeep newVk) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVk.CreatorId = userInfo.Id; return(Ok(_vks.Create(newVk, userInfo.Id))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <string> > CreateAsync([FromBody] VaultKeep newVk) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVk.CreatorId = userInfo.Id; return(Ok(_service.Create(newVk))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
async public Task <ActionResult <VaultKeep> > Post([FromBody] VaultKeep newVaultKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVaultKeep.CreatorId = userInfo.Id; return(Ok(_service.Create(newVaultKeep))); } catch (Exception err) { return(BadRequest(err.Message)); } }
public async System.Threading.Tasks.Task <ActionResult <string> > Create([FromBody] VaultKeep newVaultKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVaultKeep.CreatorId = userInfo.Id; VaultKeep vaultKeep = _vks.Create(newVaultKeep, userInfo.Id); return(Ok(vaultKeep)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > CreateAsync([FromBody] VaultKeep newVK) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVK.CreatorId = userInfo.Id; VaultKeep createdVK = _service.Create(newVK); return(Ok(createdVK)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Create([FromBody] VaultKeep newVaultKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVaultKeep.CreatorId = userInfo.Id; VaultKeep created = _vaultKeepsService.Create(newVaultKeep, userInfo); return(Ok(created)); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public async Task <ActionResult <VaultKeep> > Post([FromBody] VaultKeep newVaultKeep) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVaultKeep.creatorId = userInfo.id; VaultKeep created = _vks.Create(newVaultKeep); return(Ok(created)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Create([FromBody] VaultKeep newVK) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVK.CreatorId = userInfo.Id; _serv.Create(newVK); return(Ok("nice job")); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> Post([FromBody] VaultKeep newVaultKeep) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; newVaultKeep.UserId = userId; VaultKeep newVK = _vks.Create(newVaultKeep); _ks.Keep(newVK.KeepId); return(Ok(newVK)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Create([FromBody] VaultKeep newVaultKeep) { try { Profile userinfo = await HttpContext.GetUserInfoAsync <Profile>(); Vault vault = _vserv.GetById(newVaultKeep.VaultId, userinfo.Id); newVaultKeep.CreatorId = userinfo.Id; return(Ok(_serv.Create(newVaultKeep, vault.CreatorId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Create([FromBody] VaultKeep newVKS) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); newVKS.CreatorId = userInfo.Id; _ks.updateKeepCount(newVKS.KeepId); VaultKeep created = _vks.Create(newVKS); return(Ok(created)); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > CreateVaultKeep([FromBody] VaultKeep newVaultKeep) { try { var userInfo = await HttpContext.GetUserInfoAsync <Account>(); newVaultKeep.CreatorId = userInfo?.Id; VaultKeep vk = _vks.Create(newVaultKeep); _ks.incrementKeeps(vk.KeepId); return(Ok(vk)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <VaultKeep> > Create([FromBody] VaultKeep vaultKeep) { try { Vault original = _vs.GetOne(vaultKeep.VaultId); Profile userinfo = await HttpContext.GetUserInfoAsync <Profile>(); vaultKeep.CreatorId = userinfo.Id; return(Ok(_vks.Create(vaultKeep))); } catch (System.Exception e) { return(BadRequest(e.Message)); } }
[Authorize] //could throw it at top level i guess public ActionResult <DTOVaultKeep> Post([FromBody] DTOVaultKeep newDTOVaultKeep) { try { // var claim = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); // if(claim != null){ // newDTOVaultKeep.UserId = claim.Value; // } this broke it lol string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; newDTOVaultKeep.UserId = userId; return(Ok(_vks.Create(newDTOVaultKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> Post([FromBody] VaultKeep newVaultKeep) { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; newVaultKeep.UserId = userId; int updateId = newVaultKeep.KeepId; int vaultId = newVaultKeep.VaultId; Keep update = _ks.GetById(updateId); _vks.IncrementKeepCount(update, vaultId, userId); return(Ok(_vks.Create(newVaultKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep newVaultKeep) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("You must be logged in."); } newVaultKeep.UserId = user.Value; return(Ok(_vks.Create(newVaultKeep))); } catch (System.Exception error) { return(BadRequest(error.Message)); } }
public ActionResult <VaultKeepViewModel> Create([FromBody] VaultKeepViewModel newVaultKeep) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Must be logged in."); } newVaultKeep.UserId = user.Value; return(Ok(_vks.Create(newVaultKeep))); } catch (System.Exception) { throw; } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep newVaultKeep) { try { var user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Please Login to Continue!"); } newVaultKeep.UserId = user.Value; return(Ok(_vk.Create(newVaultKeep))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <VaultKeep> Create([FromBody] VaultKeep newVaultKeep) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("invalid id"); } // TODO why isnt this returning a userId? string userId = user.Value; return(Ok(_vks.Create(newVaultKeep))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <ActionResult <VaultKeep> > Post([FromBody] VaultKeep newVk) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); int vaultId = newVk.VaultId; Vault selectedVault = _vs.GetVaultById(vaultId, userInfo.Id); newVk.CreatorId = userInfo.Id; return(Ok(_vks.Create(newVk, userInfo.Id, selectedVault))); } catch (Exception err) { return(BadRequest(err.Message)); throw; } }