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")); }
public Keep CreateKeep([FromBody] Keep newKeep) { if (ModelState.IsValid) { var user = HttpContext.User; newKeep.UserId = user.Identity.Name; return(_db.CreateKeep(newKeep)); } return(null); }
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; }
public ActionResult <Keep> Create([FromBody] Keep keep) { Keep newKeep = _kr.CreateKeep(keep); if (newKeep == null) { return(BadRequest("Something went wrong.")); } return(Ok(newKeep)); }
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)); }
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)); } }
public ActionResult <Keep> Create([FromBody] Keep newKeep) { newKeep.UserId = HttpContext.User.FindFirstValue("Id"); return(_repo.CreateKeep(newKeep)); }