// PUT: api/Runes/5 public void Put(Rune rune) { if (ModelState.IsValid) { _service.Edit(rune); } }
public void Create(Rune rune) { //Test if I still need to ensure unique entries when Name and not Id is Key. _dc.Runes.Add(rune); _dc.SaveChanges(); }
// POST: api/Runes public HttpResponseMessage Post(Rune rune) { if (ModelState.IsValid) { _service.Create(rune); return Request.CreateResponse(HttpStatusCode.OK, rune); } return Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState); }
public void Edit(Rune rune) { var original = _dc.Runes.Find(rune.Name); if (original != null) { original.Name = rune.Name; original.Character = rune.Character; original.Short = rune.Short; original.Meaning = rune.Meaning; original.Extras = rune.Extras; original.Cardinal = rune.Cardinal; _dc.SaveChanges(); } }