Beispiel #1
0
        public ActionResult <Keep> Create([FromBody] Keep newKeep)
        {
            string id = HttpContext.User.Identity.Name;

            newKeep.UserId = id;
            return(_kr.CreateKeep(newKeep));
        }
Beispiel #2
0
        public ActionResult <Keep> Create([FromBody] Keep newKeep)
        {
            var UserId = HttpContext.User.FindFirstValue("Id");

            newKeep.UserId = UserId;
            return(_kr.CreateKeep(newKeep));
        }
 public Keep Create([FromBody] Keep newKeep)
 {
     // var user = HttpContext.User;
     // newKeep.UserId = user.Identity.Name;
     if (ModelState.IsValid)
     {
         return(db.CreateKeep(newKeep));
     }
     return(null);
 }
Beispiel #4
0
        public ActionResult <Keep> Create([FromBody] Keep keep)
        {
            keep.userId = HttpContext.User.Identity.Name;
            Keep newKeep = _pr.CreateKeep(keep);

            if (newKeep == null)
            {
                return(BadRequest("Keep creation failed!"));
            }
            return(Ok(newKeep));
        }
Beispiel #5
0
 [HttpPost] //NOTE "Can Create Keep"
 public ActionResult <Keep> Post([FromBody] Keep keep)
 {
     try
     {
         keep.UserId = HttpContext.User.FindFirstValue("Id"); // THIS IS HOW YOU GET THE ID of the currently logged in user
         return(Ok(_repo.CreateKeep(keep)));
     }
     catch (Exception e)
     {
         return(BadRequest("Incorrect Data"));
     }
 }
Beispiel #6
0
 public ActionResult <Keep> Post([FromBody] Keep keep)
 {
     keep.UserId = HttpContext.User.FindFirstValue("Id");
     try
     {
         return(Ok(_kr.CreateKeep(keep)));
     }
     catch (System.Exception)
     {
         throw;
     }
 }
 public ActionResult <Keep> Post([FromBody] Keep keep)
 {
     try
     {
         keep.UserId = HttpContext.User.FindFirstValue("Id");
         return(Ok(_repo.CreateKeep(keep)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public Keep CreateKeep(Keep newKeep)
 {
     newKeep.Id = _repo.CreateKeep(newKeep);
     return(newKeep);
 }
Beispiel #9
0
 public Keep CreateKeep(Keep newKeep)
 {
     return(_repo.CreateKeep(newKeep));
 }