Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Roladex roladex = db.Roladexes.Find(id);

            db.Roladexes.Remove(roladex);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "RoladexId,Company,Name,PhoneNo,Email,Address,City,State,ZipCode,Country,Notes")] Roladex roladex)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roladex).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roladex));
 }
Beispiel #3
0
        // GET: Roladex/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Roladex roladex = db.Roladexes.Find(id);

            if (roladex == null)
            {
                return(HttpNotFound());
            }
            return(View(roladex));
        }
Beispiel #4
0
        public IHttpActionResult Post([FromBody] Person p)
        {
            if (p != null)
            {
                // Make a call to CRUD Method to insert in to DB

                Roladex roladex = new Roladex();
                crud = new RolData(roladex);
                try
                {
                    crud.Populate();
                    roladex.Add(p);
                    crud.PersistDB();
                }
                catch (Exception)
                { return(BadRequest()); }
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
 public void Add(Roladex roladex)
 {
     data.Add(roladex);
 }