public IHttpActionResult PutCAUser(int id, CAUser cAUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cAUser.Id) { return(BadRequest()); } db.Entry(cAUser).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CAUserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { CAUser cAUser = db.CAUsers.Find(id); db.CAUsers.Remove(cAUser); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,FacebookID,Alias,Email,CreationDate")] CAUser cAUser) { if (ModelState.IsValid) { db.Entry(cAUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cAUser)); }
public IHttpActionResult GetCAUser(int id) { CAUser cAUser = db.CAUsers.Find(id); if (cAUser == null) { return(NotFound()); } return(Ok(cAUser)); }
public IHttpActionResult GetUserByFacebookId(string id) { CAUser user = db.CAUsers.Where(x => x.FacebookID == id).FirstOrDefault(); if (user == null) { return(NotFound()); } return(Ok(user)); }
public ActionResult Create([Bind(Include = "Id,FacebookID,Alias,Email,CreationDate")] CAUser cAUser) { if (ModelState.IsValid) { db.CAUsers.Add(cAUser); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cAUser)); }
public IHttpActionResult PostCAUser(CAUser cAUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CAUsers.Add(cAUser); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = cAUser.Id }, cAUser)); }
public IHttpActionResult DeleteCAUser(int id) { CAUser cAUser = db.CAUsers.Find(id); if (cAUser == null) { return(NotFound()); } db.CAUsers.Remove(cAUser); db.SaveChanges(); return(Ok(cAUser)); }
// GET: CAUsersViews/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CAUser cAUser = db.CAUsers.Find(id); if (cAUser == null) { return(HttpNotFound()); } return(View(cAUser)); }