public ActionResult DeleteConfirmed(int id) { DefectGroup defectGroup = db.DefectGroups.Find(id); db.DefectGroups.Remove(defectGroup); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult Delete(int DefectGroupID) { DefectGroup.Delete( DefectGroupID, _Repository ); return(Ok()); }
public IHttpActionResult Create(DefectGroup NewDefectGroup) { NewDefectGroup.Create(_Repository); return(Created <DefectGroup>( Request.RequestUri + "/" + NewDefectGroup.NodeID.ToString(), NewDefectGroup )); }
public ActionResult Edit([Bind(Include = "DefectGroupId,GroupName,DisplayOrder,Info")] DefectGroup defectGroup) { if (ModelState.IsValid) { db.Entry(defectGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(defectGroup)); }
public ActionResult Create([Bind(Include = "DefectGroupId,GroupName,DisplayOrder,Info")] DefectGroup defectGroup) { if (ModelState.IsValid) { db.DefectGroups.Add(defectGroup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(defectGroup)); }
// GET: DefectGroups/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DefectGroup defectGroup = db.DefectGroups.Find(id); if (defectGroup == null) { return(HttpNotFound()); } return(View(defectGroup)); }
public ActionResult Create([Bind(Include = "DefectGroupId,NewGroupName,PossibleDefectId,DefectName,DefectCost,VersionId")] PossibleDefect possibleDefect, int?DefectGroup, string NewGroupName = null) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { int?groupId = DefectGroup; // Create New Group if (!String.IsNullOrEmpty(NewGroupName)) { int? maxDisplayOrder = db.DefectGroups.Max(d => d.DisplayOrder); DefectGroup group = new DefectGroup(); group.GroupName = NewGroupName; group.DisplayOrder = maxDisplayOrder + 1; db.DefectGroups.Add(group); db.SaveChanges(); groupId = group.DefectGroupId; } // Add the Defect possibleDefect.DefectGroupId = groupId; db.PossibleDefects.Add(possibleDefect); db.SaveChanges(); dbContextTransaction.Commit(); } catch (Exception ex) { ViewBag.Message = "An error was encountered while attempting to complete your transaction. <br />" + "Error Message: " + ex; dbContextTransaction.Rollback(); ViewBag.DefectGroup = new SelectList(db.DefectGroups, "DefectGroupId", "GroupName", "-- Select Group --"); ViewBag.VersionId = new SelectList(db.PhoneVersions, "VersionId", "Version"); return(RedirectToAction("Create")); } return(RedirectToAction("Index")); } }
public ActionResult Create([Bind(Include = "DefectTemplateId,DefectName,DefectCost,DefectGroupId")] DefectTemplate defectTemplate, string NewGroupName = null) { // Create New Group if (!String.IsNullOrEmpty(NewGroupName)) { int? maxDisplayOrder = db.DefectGroups.Max(d => d.DisplayOrder); DefectGroup group = new DefectGroup(); group.GroupName = NewGroupName; group.DisplayOrder = maxDisplayOrder + 1; db.DefectGroups.Add(group); db.SaveChanges(); } if (ModelState.IsValid) { db.DefectTemplates.Add(defectTemplate); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(defectTemplate)); }
public IHttpActionResult Update(int DefectGroupID, DefectGroup UpdatedDefectGroup) { UpdatedDefectGroup.Update(_Repository); return(Ok()); }
public IHttpActionResult Get() { return(Ok <IEnumerable <Hierarchy> >( DefectGroup.GetHierarchy(_Repository) )); }