public IHttpActionResult PutProjectBoard(int id, ProjectBoard projectBoard) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != projectBoard.ID) { return BadRequest(); } projectBoard.User = HttpContext.Current.User.Identity.Name.ToString(); db.Entry(projectBoard).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProjectBoardExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostProjectBoard(ProjectBoard projectBoard) { projectBoard.UpdateDate = DateTime.Now; if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ProjectBoard.Add(projectBoard); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = projectBoard.ID }, projectBoard); }
public List<Column> GetColumns(ProjectBoard ProjectBoard) { if (HttpContext.Current.Cache["columns"] == null) { if (ProjectBoard.Configuration == "" || ProjectBoard.Configuration == null) { var columns = new List<Column>(); var stories = new List<Stories>(); columns.Add(new Column { Description = "Backlog Column", Id = 1, Name = "Backlog", Stories = stories }); columns.Add(new Column { Description = "In Progress Column", Id = 2, Name = "In Progress", Stories = new List<Stories>() }); columns.Add(new Column { Description = "Pending Column", Id = 3, Name = "Pending", Stories = new List<Stories>() }); columns.Add(new Column { Description = "Release Column", Id = 4, Name = "Release", Stories = new List<Stories>() }); HttpContext.Current.Cache["columns"] = columns; } else { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); string jsonString = ProjectBoard.Configuration; List<Column> columns = (List<Column>)javaScriptSerializer.Deserialize(jsonString, typeof(List<Column>)); HttpContext.Current.Cache["columns"] = columns; } } return (List<Column>)HttpContext.Current.Cache["columns"]; }