public bool AddIssue(IssueAjax item) { try { var issue = new Issue { CreatedOn = DateTime.Now, ModifiedOn = null, Status = item.StatusId, Type = item.TypeId, Title = item.Title, Description = item.Description }; return DbMethods.AddIssue(issue); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }
public bool UpdateIssue(IssueAjax item) { return DbMethods.UpdateIssue(item); }
public static bool UpdateIssue(IssueAjax issue) { try { using (var db = new IssuesEntities()) { var iss = (from i in db.Issue where i.Id == issue.Id select i).Single(); iss.ModifiedOn = DateTime.Now; iss.Title = issue.Title; iss.Description = issue.Description; iss.Type = issue.TypeId; iss.Status = issue.StatusId; db.Issue.AddOrUpdate(iss); db.SaveChanges(); return true; } } catch (Exception e) { Console.WriteLine(e.Message); return false; } }