public ActionResult DeleteConfirmed(int id)
        {
            CauseType causeType = db.CauseTypes.Find(id);

            db.CauseTypes.Remove(causeType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult CauseTypeDeleteConfirmed(int id)
        {
            CauseType type    = db.CauseTypes.Single(p => p.CauseTypeId == id);
            var       groupId = type.CauseGroupId;

            db.CauseTypes.Remove(type);
            db.SaveChanges();
            return(RedirectToAction("CauseTypeList", new { groupId = groupId }));
        }
 public ActionResult Edit([Bind(Include = "CauseTypeID,CauseTypeName")] CauseType causeType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(causeType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(causeType));
 }
        public ActionResult Create([Bind(Include = "CauseTypeID,CauseTypeName")] CauseType causeType)
        {
            if (ModelState.IsValid)
            {
                db.CauseTypes.Add(causeType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(causeType));
        }
        // GET: CauseTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CauseType causeType = db.CauseTypes.Find(id);

            if (causeType == null)
            {
                return(HttpNotFound());
            }
            return(View(causeType));
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Cause"/> class.
 /// </summary>
 /// <param name="type">The <see cref="CauseType"/> of the <see cref="Cause"/>.</param>
 /// <param name="position">The position in the corresponding append-only log where the instance of the cause is located.</param>
 public Cause(CauseType type, CauseLogPosition position)
 {
     Type     = type;
     Position = position;
 }