public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                IssueAttachment issueAtchmnt = GetIssueAttachmentByID(id);

                if (issueAtchmnt == null)
                {
                    return(RedirectToAction("Index", "Issue"));
                }
                else
                {
                    //delete file from the server
                    FileInfo file = new FileInfo(basePath + issueAtchmnt.Filename);
                    file.Delete();

                    //delete entry from database
                    _dataModel.DeleteObject(issueAtchmnt);
                    _dataModel.SaveChanges();
                }

                return(RedirectToAction("Index", "Issue"));
            }
            catch
            {
                return(RedirectToAction("Index", "Issue"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Document doc = GetDocumentByID(id);

                if (doc == null)
                {
                    return(RedirectToAction("Index"));
                }

                //delete entry from database
                _dataModel.DeleteObject(doc);
                _dataModel.SaveChanges();

                //delete file from the server
                FileInfo docFile = new FileInfo(basePath + doc.FileName);
                if (docFile.Exists)
                {
                    docFile.Delete();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(string TeamName, FormCollection collection)
        {
            try
            {
                Team team = GetTeamByName(TeamName);

                if (team == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(team);

                //get developers belonging to that team
                List <Developer> devs = _dataModel.Developers
                                        .Where(d => d.TeamName.Contains(TeamName)).ToList();

                foreach (Developer dev in devs)
                {
                    //unbind developer from the team
                    dev.TeamName = "";
                }

                _dataModel.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 4
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Message msg = GetMessageByID(id);
                _dataModel.DeleteObject(msg);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(string TaskCategoryName, FormCollection collection)
        {
            try
            {
                TaskCategory taskcat = GetTaskCategoryByName(TaskCategoryName);

                if (taskcat == null)
                {
                    return(RedirectToAction("Index", "Task"));
                }

                _dataModel.DeleteObject(taskcat);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index", "Task"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Developer dev = GetDeveloperByID(id);

                if (dev == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(dev);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 7
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Project proj = GetProjectByID(id);

                if (proj == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(proj);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                TaskAssignment taskAsgnmt = GetTaskAssignmentByID(id);

                if (taskAsgnmt == null)
                {
                    return(RedirectToAction("Index", "Task"));
                }

                _dataModel.DeleteObject(taskAsgnmt);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index", "Task"));
            }
            catch
            {
                return(RedirectToAction("Index", "Task"));
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Note note = GetNoteByID(id);

                if (note == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(note);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 10
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Client client = GetClientByID(id);

                if (client == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(client);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Topic topic = GetTopicByID(id);

                if (topic == null)
                {
                    return(RedirectToAction("Index", "Message"));
                }

                _dataModel.DeleteObject(topic);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index", "Message"));
            }
            catch
            {
                return(RedirectToAction("Index", "Message"));
            }
        }
Ejemplo n.º 12
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Task task = GetTaskByID(id);

                if (task == null)
                {
                    return(RedirectToAction("Index"));
                }

                _dataModel.DeleteObject(task);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Delete(string IssueCategoryName, FormCollection collection)
        {
            try
            {
                IssueCategory issueCat = GetIssueCategoryByName(IssueCategoryName);

                if (issueCat == null)
                {
                    return(RedirectToAction("Index", "Issue"));
                }

                _dataModel.DeleteObject(issueCat);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index", "Issue"));
            }
            catch
            {
                return(RedirectToAction("Index", "Issue"));
            }
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                Milestone milestone = GetMilestoneByID(id);

                if (milestone == null)
                {
                    return(RedirectToAction("Index", "Project"));
                }

                _dataModel.DeleteObject(milestone);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index", "Project"));
            }
            catch
            {
                return(RedirectToAction("Index", "Project"));
            }
        }