Example #1
0
        public ActionResult <Keep> Create([FromBody] Keep keep)
        {
            Keep newKeep = _pr.CreateKeep(keep);

            if (newKeep == null)
            {
                return(BadRequest("Failed to create keep"));
            }
            return(Ok(keep));
        }
Example #2
0
        public ActionResult <Keep> Create([FromBody] Keep keep)
        {
            keep.UserId = HttpContext.User.Identity.Name;
            Keep newKeep = _kr.CreateKeep(keep);

            if (newKeep == null)
            {
                return(BadRequest("Whoops Something didn't work"));
            }
            return(Ok(newKeep));
        }
        public ActionResult <Keep> Create([FromBody] Keep rawKeep)
        {
            rawKeep.UserId = HttpContext.User.Identity.Name;
            Keep newKeep = _kr.CreateKeep(rawKeep);

            if (newKeep == null)
            {
                return(BadRequest("Something had gone horribly wrong"));
            }
            return(Ok(newKeep));
        }
        public ActionResult <Keep> Create([FromBody] Keep keep)
        {
            keep.UserId = HttpContext.User.Identity.Name;
            Keep newKeep = _kr.CreateKeep(keep);

            if (newKeep == null)
            {
                return(BadRequest("Unable to POST: Keep doesn't exist."));
            }
            return(Ok(newKeep));
        }
Example #5
0
 public ActionResult <Keep> Post([FromBody] Keep keep)
 {
     try
     {
         keep.UserId = HttpContext.User.FindFirstValue("Id");
         return(Ok(_repo.CreateKeep(keep)));
     }
     catch (Exception e)
     {
         return(BadRequest("Bad Request"));
     }
 }
Example #6
0
        public ActionResult <Keep> CreateKeep([FromBody] Keep newKeep)
        {
            Keep intermediate = newKeep;

            var id   = HttpContext.User.FindFirstValue("Id");
            var user = _userRepo.GetUserById(id);

            if (user != null)
            {
                intermediate.userId = id;

                return(Ok(_keepRepo.CreateKeep(intermediate)));
            }

            return(BadRequest());
        }