public bool add(IssueModel issue) { Guid id = issue.id; string title = issue.title; string symptom = issue.symptom; string diagnostic = issue.diagnostic; string fix = issue.fix; string comments = issue.comments; bool inserted = false; using (KnowledgeBaseContext dc = new KnowledgeBaseContext(connectionString, mapping)) { if (dc.addIssue(id, title, symptom, diagnostic, fix, comments)>0) { inserted = true; } } return inserted; }
public ActionResult Add(IssueModel issue) { issue.id = Guid.NewGuid(); issue.comments = string.IsNullOrEmpty(issue.comments) ? string.Empty : issue.comments; if (ModelState.IsValid) { if (new KnowledgeBase.Services.DataBase.Context.Issue(Server.MapPath("~")).add(issue)) { ViewBag.SuccessMessage = "Issue succesfully recorded."; ModelState.Clear(); return View("Register", null); } else { ViewBag.ErrorMessage = "Please retry."; return View("Register", issue); } } else { ViewBag.ErrorMessage = "Please fill all the required fields"; return View("Register", issue); } }