コード例 #1
0
 // PUT: api/Runes/5
 public void Put(Rune rune)
 {
     if (ModelState.IsValid)
     {
         _service.Edit(rune);
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
 // 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);
 }
コード例 #4
0
        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();
            }
        }