示例#1
0
        public JsonResult AddBug(string name, string description, Bug.BugType type, Bug.PriorityLevel priority, int resolver, int tester)
        {
            db.Bugs.Add(new Bug()
            {
                CreatorID = UserUtils.CurrentUser.ID,
                Name = name,
                Description = description,
                Type = type,
                Priority = priority,
                CurrentState = Bug.State.Created,
                InsertDate = DateTime.Now,
                ResolverID = resolver,
                TesterID = tester
            });

            return Json(new { success = db.SaveChanges() == 1 });
        }
示例#2
0
        public JsonResult EditBug(int bugID, string name, string description, Bug.BugType type, Bug.PriorityLevel priority, int resolver, int tester, Bug.State currentState)
        {
            var bug = db.Bugs.Find(bugID);
            bool success = false;

            if (bug != null && bug.ID == bugID)
            {
                bug.Name = name;
                bug.Description = description;
                bug.Type = type;
                bug.Priority = priority;
                bug.ResolverID = resolver;
                bug.TesterID = tester;
                bug.CurrentState = currentState;

                success = (db.SaveChanges() == 1);
            }

            return Json(new { });
        }