public IHttpActionResult PutPurchaseEventCategory(int id, PurchaseEventCategory purchaseEventCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != purchaseEventCategory.ID)
            {
                return(BadRequest());
            }

            db.Entry(purchaseEventCategory).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PurchaseEventCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            PurchaseEventCategory purchaseEventCategory = db.PurchaseEventCategories.Find(id);

            db.PurchaseEventCategories.Remove(purchaseEventCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "ID,Name,Description,StartingDate")] PurchaseEventCategory purchaseEventCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(purchaseEventCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(purchaseEventCategory));
 }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "ID,Name,Description,StartingDate")] PurchaseEventCategory purchaseEventCategory)
        {
            if (ModelState.IsValid)
            {
                db.PurchaseEventCategories.Add(purchaseEventCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(purchaseEventCategory));
        }
        public IHttpActionResult GetPurchaseEventCategory(int id)
        {
            PurchaseEventCategory purchaseEventCategory = db.PurchaseEventCategories.Find(id);

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

            return(Ok(purchaseEventCategory));
        }
        public IHttpActionResult PostPurchaseEventCategory(PurchaseEventCategory purchaseEventCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PurchaseEventCategories.Add(purchaseEventCategory);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = purchaseEventCategory.ID }, purchaseEventCategory));
        }
Exemplo n.º 7
0
        // GET: PurchaseEventCategories/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PurchaseEventCategory purchaseEventCategory = db.PurchaseEventCategories.Find(id);

            if (purchaseEventCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(purchaseEventCategory));
        }
        public IHttpActionResult DeletePurchaseEventCategory(int id)
        {
            PurchaseEventCategory purchaseEventCategory = db.PurchaseEventCategories.Find(id);

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

            db.PurchaseEventCategories.Remove(purchaseEventCategory);
            db.SaveChanges();

            return(Ok(purchaseEventCategory));
        }