public IHttpActionResult Change(BugModel model) { if (!ModelState.IsValid) { return(BadRequest()); } var bug = this.data.Bugs .Find(model.id); if (bug == null) { return(NotFound()); } bug.Status = model.Status; bug.Text = model.Text; this.data.SaveChanges(); model.id = bug.Id; return(Ok(model)); }
public IHttpActionResult Change(BugModel model) { if (!ModelState.IsValid) { return BadRequest(); } var bug = this.data.Bugs .Find(model.id); if (bug == null) { return NotFound(); } bug.Status = model.Status; bug.Text = model.Text; this.data.SaveChanges(); model.id = bug.Id; return Ok(model); }
public IHttpActionResult Get(BugModel model) { if (!ModelState.IsValid) { return(BadRequest()); } var bug = new Bug() { Text = model.Text, LogDate = DateTime.Now.Date, Status = model.Status, }; this.data.Bugs.Add(bug); this.data.SaveChanges(); model.id = bug.Id; model.LogDate = bug.LogDate; return(Ok(model)); }
public IHttpActionResult Get(BugModel model) { if (!ModelState.IsValid) { return BadRequest(); } var bug = new Bug() { Text = model.Text, LogDate = DateTime.Now.Date, Status = model.Status, }; this.data.Bugs.Add(bug); this.data.SaveChanges(); model.id = bug.Id; model.LogDate = bug.LogDate; return Ok(model); }