예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DefectGroup defectGroup = db.DefectGroups.Find(id);

            db.DefectGroups.Remove(defectGroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public IHttpActionResult Delete(int DefectGroupID)
        {
            DefectGroup.Delete(
                DefectGroupID, _Repository
                );

            return(Ok());
        }
예제 #3
0
        public IHttpActionResult Create(DefectGroup NewDefectGroup)
        {
            NewDefectGroup.Create(_Repository);

            return(Created <DefectGroup>(
                       Request.RequestUri + "/" + NewDefectGroup.NodeID.ToString(),
                       NewDefectGroup
                       ));
        }
예제 #4
0
 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));
 }
예제 #5
0
        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));
        }
예제 #6
0
        // 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"));
            }
        }
예제 #8
0
        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));
        }
예제 #9
0
        public IHttpActionResult Update(int DefectGroupID, DefectGroup UpdatedDefectGroup)
        {
            UpdatedDefectGroup.Update(_Repository);

            return(Ok());
        }
예제 #10
0
 public IHttpActionResult Get()
 {
     return(Ok <IEnumerable <Hierarchy> >(
                DefectGroup.GetHierarchy(_Repository)
                ));
 }