public ActionResult Create(string Subject, string Priority, string Severity, string Status,
            string Description, string IssueCategoryName, int? MilestoneID, int ProjectID, HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
                return View();

            try
            {
                Issue issue = new Issue();
                issue.Subject = Subject;
                issue.Priority = Priority;
                issue.Severity = Severity;
                issue.Status = Status;
                issue.Description = Description;
                issue.EntryDate = DateTime.Now;
                issue.IssueCategoryName = IssueCategoryName;
                issue.MilestoneID = MilestoneID;
                issue.ProjectID = ProjectID;
                _dataModel.AddToIssues(issue);
                _dataModel.SaveChanges();

                //Save file to server if user selected a file
                if (file != null && file.ContentLength > 0)
                {
                    IssueAttachment issueAttchmnt = new IssueAttachment();
                    issueAttchmnt.Filename = Path.GetFileName(file.FileName);
                    issueAttchmnt.MimeType = file.ContentType;
                    var path = Path.Combine(basePath, issueAttchmnt.Filename);
                    file.SaveAs(path);
                    issueAttchmnt.DeveloperID = _dataModel.Developers.Single(d => d.UserName == User.Identity.Name).DeveloperID;
                    issueAttchmnt.EntryDate = DateTime.Now;
                    issueAttchmnt.IssueID = issue.IssueID;
                    _dataModel.AddToIssueAttachments(issueAttchmnt);
                    _dataModel.SaveChanges();
                }
                return RedirectToAction("Index");
            }
            catch
            {
                return RedirectToAction("Index");
            }
        }
 /// <summary>
 /// Create a new Issue object.
 /// </summary>
 /// <param name="issueID">Initial value of the IssueID property.</param>
 /// <param name="subject">Initial value of the Subject property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="projectID">Initial value of the ProjectID property.</param>
 public static Issue CreateIssue(global::System.Int32 issueID, global::System.String subject, global::System.String description, global::System.Int32 projectID)
 {
     Issue issue = new Issue();
     issue.IssueID = issueID;
     issue.Subject = subject;
     issue.Description = description;
     issue.ProjectID = projectID;
     return issue;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Issues EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToIssues(Issue issue)
 {
     base.AddObject("Issues", issue);
 }