public ActionResult <IEnumerable <Keep> > Get() { try { return(Ok(_ks.Get())); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <IEnumerable <Keep> > Get() { try { return(Ok(_kService.Get())); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
[Fact] //Checks if Get returns List<Keep> public void CanGetResults() { moqKeepsRepository.Setup(repo => repo.Get()).Returns(new List <Keep>()); var result = keepsService.Get(); Assert.Equal(new List <Keep>(), result); }
public ActionResult <IEnumerable <Keep> > Get(int id) { try { return(Ok(_kserv.Get(id))); } catch (Exception err) { return(BadRequest(err.Message)); } }
[HttpGet] //Get All api/keeps public ActionResult <IEnumerable <Keep> > Get() //TODO somehow gotta make this also get private ones if youre the poster { try { return(Ok(_ks.Get())); } catch (Exception e) { return(BadRequest(e.Message)); }; }
public ActionResult <Keep> Get(int id) { try { return(Ok(_ks.Get(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
[TestMethod] //Checks if Get returns List<Keep> public void CanGetResults() { var list = new List <Keep>(); moqKeepsRepository.Setup(repo => repo.Get()).Returns(list); var result = keepsService.Get(); moqKeepsRepository.Verify(repo => repo.Get()); Assert.AreEqual(list, result); }
public ActionResult <IEnumerable <Keep> > Get() { try { // var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_ks.Get())); } catch (Exception e) { return(BadRequest(e.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))); }