public int AddCard(Card card) { if (card == null) { throw new Exception("AddCard method error: Card is null"); } var todolist = new Todolist { Title = "Todolist", TodoIds = "" }; _todolistContext.Todolists.Add(todolist); _todolistContext.SaveChanges(); card.TodolistId = todolist.Id; _db.Cards.Add(card); _db.SaveChanges(); var board = _dbBoard.Boards.Find(card.BoardId); board.AddCardId(card.Id); _dbBoard.Boards.Update(board); _dbBoard.SaveChanges(); var column = _dbColumn.Columns.Find(card.ColumnId); column.AddCardId(card.Id); _dbColumn.Columns.Update(column); _dbColumn.SaveChanges(); return(card.Id); }
public int AddBoard(Board board) { if (board == null) { throw new Exception("AddBoard method error: board is null"); } _db.Boards.Add(board); _db.SaveChanges(); return(board.Id); }
public void UpdateCard(CardDetails cardModel) { var card = boardContext.Cards.FirstOrDefault(x => x.Id == cardModel.Id); card.Notes = cardModel.Notes; card.Title = cardModel.Title; card.ColumnId = cardModel.ColumnId; boardContext.SaveChanges(); }
public ActionResult AddCardSignal(Card card) { if (ModelState.IsValid) { db.Cards.Add(card); db.SaveChanges(); return(Json(card.CardID, JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Board board) { if (ModelState.IsValid) { db.Boards.Add(board); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(board)); }
public ActionResult Create([Bind(Include = "JobID,Title,PositionType,Salary")] Job job) { if (ModelState.IsValid) { db.Jobs.Add(job); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(job)); }
public IActionResult Post(int boardId, string name) { var state = new IssueState { Name = name, BoardId = boardId }; _context.IssueStates.Add(state); _context.SaveChanges(); _connectionManager.BroadcastAddState(Result.ToModel(state)); return(Result.Created(state)); }
public static Tuple <bool, string> registerProcess(IFormCollection form) { string username = form["username"]; string password = form["password"]; string confirmPassword = form["confirm_password"]; var db = new BoardContext(); if (password != confirmPassword) { return(new Tuple <bool, string>(false, "Passwords are different")); } else if (db.Users.Any(x => x.username == username)) { return(new Tuple <bool, string>(false, "Username already exists")); } // Password encryption password = crypto(password); // Register Action User newUser = new User(username, password); newUser.token = tokenGenerator(newUser); db.Add(newUser); db.SaveChanges(); return(new Tuple <bool, string>(true, "Register with Success!")); }
public void Handle(MoveTaskCommand message) { using (var ctx = new BoardContext()) { Board board = ctx.Boards.FirstOrDefault(b => b.Id == message.BoardId); if (message.SourceListId != message.DestinationListId) { List source = board.Lists.First(l => l.Id == message.SourceListId); Task task = source.Tasks.First(t => t.Id == message.TaskId); List destintation = board.Lists.First(l => l.Id == message.DestinationListId); destintation.Tasks = destintation.Tasks.OrderBy(t => t.Order).ToList(); destintation.InsertTask(message.TargetIndex, task); source.Tasks.Remove(task); OrderTasks(source); OrderTasks(destintation); } else { List source = board.Lists.First(l => l.Id == message.SourceListId); Task task = source.Tasks.First(t => t.Id == message.TaskId); source.Tasks.Remove(task); source.InsertTask(message.TargetIndex, task); OrderTasks(source); } ctx.SaveChanges(); } }
public void Drop(int post) { using (var context = new BoardContext()) { context.Posts.Remove(context.Posts.Single(p => p.Id == post)); context.SaveChanges(); } }
public void Drop(int index) { using (var context = new BoardContext()) { context.Comments.Remove(context.Comments.Single(c => c.Id == index)); context.SaveChanges(); } }
public void Add(Attachment attach) { using (var context = new BoardContext()) { context.Attachments.Add(attach); context.SaveChanges(); } }
public void Add(Channel channel) { using (var context = new BoardContext()) { context.Channels.Add(channel); context.SaveChanges(); } }
public void Edit(User user) { using (var context = new BoardContext()) { context.Database.Log = Console.WriteLine; context.Entry(user).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(User user) { using (var context = new BoardContext()) { context.Database.Log = Console.WriteLine; context.Users.Add(user); context.SaveChanges(); } }
public IActionResult Post(int boardId, int?stateId, string title) { var issue = new Issue { Title = title, BoardId = boardId, StateId = stateId }; _context.Issues.Add(issue); _context.SaveChanges(); var issueModel = Result.ToModel(issue); _connectionManager.BroadcastAddIssue(issueModel); return(Result.Created(issue)); }
public void Add(Announcement announcement) { using (var context = new BoardContext()) { announcement.Administrator = context.Administrators.Single(o => o.Id == announcement.Id); context.Announcments.Add(announcement); context.SaveChanges(); } }
public void Add(Administrator admin) { using (var context = new BoardContext()) { context.Database.Log = Console.WriteLine; context.Administrators.Add(admin); context.SaveChanges(); } }
public ActionResult Create([Bind(Include = "LastName, FirstName, Degree")] Candidate candidate) { try { if (ModelState.IsValid) { db.Candidates.Add(candidate); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (RetryLimitExceededException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(candidate)); }
public ActionResult Create(Board model) { if (ModelState.IsValid) { _context.Boards.Add(model); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public int AddColumn(Column column) { if (column == null) { throw new Exception("AddColumn method error: column is null"); } var board = _dbBoards.Boards.Find(column.BoardId); if (board == null) { throw new Exception("AddColumn method error: board is null"); } _db.Columns.Add(column); _db.SaveChanges(); board.AddColumnId(column.Id); _dbBoards.Update(board); _dbBoards.SaveChanges(); return(column.Id); }
public void Edit(Comment comment) { using (var context = new BoardContext()) { var dbComment = context.Comments.Include(u => u.User).Include(p => p.Post).Single(c => c.Id == comment.Id); dbComment.Content = comment.Content; context.Entry(dbComment).State = EntityState.Modified; context.SaveChanges(); } }
public void Edit(Post post) { using (var context = new BoardContext()) { Post dbPost = context.Posts.Include(p => p.User).Include(p => p.Channel).Single(p => p.Id == post.Id); dbPost.Content = post.Content; dbPost.Title = post.Title; context.Entry(dbPost).State = EntityState.Modified; context.SaveChanges(); } }
public void Drop(int channel) { using (var context = new BoardContext()) { var dChannel = context.Channels.Single(c => c.Id == channel); if (dChannel != null) { context.Channels.Remove(dChannel); } context.SaveChanges(); } }
public void Add(Post post) { using (var context = new BoardContext()) { context.Database.Log = Console.WriteLine; var id = post.User.Id; post.User = context.Users.Single(o => o.Id == id); post.Channel = context.Channels.Single(c => c.Id == post.Channel.Id); context.Posts.Add(post); context.SaveChanges(); } }
public IActionResult Post(string name) { var board = new Board { Name = name }; _context.Boards.Add(board); _context.SaveChanges(); return(Result.Created(board)); }
public void Drop(Announcement announcement) { using (var context = new BoardContext()) { var dAnn = context.Announcments.Single(a => a.Id == announcement.Id); if (dAnn != null) { context.Announcments.Remove(dAnn); } context.SaveChanges(); } }
public void Drop(Attachment attach) { using (var context = new BoardContext()) { var dAttach = context.Attachments.Single(a => a.Id == attach.Id); if (dAttach != null) { context.Attachments.Remove(dAttach); } context.SaveChanges(); } }
public void Add(Comment comment) { using (var context = new BoardContext()) { context.Database.Log = Console.WriteLine; comment.Post = context.Posts.Single(p => p.Id == comment.Post.Id); comment.User = context.Users.Single(u => u.Id == comment.User.Id); comment.Date = DateTime.Now; context.Comments.Add(comment); context.SaveChanges(); } }
// POST api/boardapi public List Post([FromBody] CreateList input) { using (var ctx = new BoardContext()) { Board board = ctx.Boards.Where(b => b.Id == input.BoardId).First(); var list = new List { Name = input.name }; board.Lists.Add(list); ctx.Set <List>().Add(list); ctx.SaveChanges(); return(list); } }