Ejemplo n.º 1
0
        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));
 }
Ejemplo n.º 4
0
        public IHttpActionResult GetCAUser(int id)
        {
            CAUser cAUser = db.CAUsers.Find(id);

            if (cAUser == null)
            {
                return(NotFound());
            }

            return(Ok(cAUser));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }