Esempio n. 1
0
 public ActionResult <Keep> Create([FromBody] Keep newKeep)
 {
     newKeep.UserId = HttpContext.User.Identity.Name;
     if (newKeep.UserId != null)
     {
         Keep result = _kr.CreateKeep(newKeep);
         return(Ok(result));
     }
     return(Unauthorized("you must login to create a keep"));
 }
Esempio n. 2
0
 public Keep CreateKeep([FromBody] Keep newKeep)
 {
     if (ModelState.IsValid)
     {
         var user = HttpContext.User;
         newKeep.UserId = user.Identity.Name;
         return(_db.CreateKeep(newKeep));
     }
     return(null);
 }
Esempio n. 3
0
 public Keep CreateKeep(int id, [FromBody]Keep newKeep)
 {
     // newKeep.VaultId = id;
     if (ModelState.IsValid)
     {
     newKeep.AuthorId = HttpContext.User.Identity.Name;
         return _db.CreateKeep(newKeep);
     }
     return null;
 }
Esempio n. 4
0
        public ActionResult <Keep> Create([FromBody] Keep keep)
        {
            Keep newKeep = _kr.CreateKeep(keep);

            if (newKeep == null)
            {
                return(BadRequest("Something went wrong."));
            }
            return(Ok(newKeep));
        }
Esempio n. 5
0
        public ActionResult <Keep> Create([FromBody] Keep keepData)
        {
            keepData.UserId = HttpContext.User.Identity.Name;
            Keep newKeep = _kr.CreateKeep(keepData);

            if (newKeep == null)
            {
                return(BadRequest("Cannot Create"));
            }
            return(Ok(newKeep));
        }
Esempio n. 6
0
 public Keep CreateKeep([FromBody] Keep newKeep)
 {
     newKeep.Keeps    = 0;
     newKeep.Views    = 0;
     newKeep.AuthorId = HttpContext.User.Identity.Name;
     if (ModelState.IsValid)
     {
         return(_db.CreateKeep(newKeep));
     }
     return(null);
 }
 public ActionResult <Keep> Post([FromBody] Keep keep)
 {
     try
     {
         keep.userId = HttpContext.User.FindFirstValue("Id");
         return(Ok(_repository.CreateKeep(keep)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Esempio n. 8
0
 public ActionResult <Keep> Create([FromBody] Keep newKeep)
 {
     newKeep.UserId = HttpContext.User.FindFirstValue("Id");
     return(_repo.CreateKeep(newKeep));
 }