public ActionResult Create(AnObject anObject) { try { var response = GetClient().PostAsJsonAsync("api/values", anObject).Result; response.EnsureSuccessStatusCode(); return RedirectToAction("Index"); } catch { return View(anObject); } }
public ActionResult Edit(int id, AnObject anObject) { try { var response = GetClient().PutAsJsonAsync(string.Format("api/values/{0}", id), anObject).Result; response.EnsureSuccessStatusCode(); return RedirectToAction("Index"); } catch { return View(); } }
internal void Add(AnObject value) { value.Id = ++_inc; List.Add(value); }
internal void Remove(AnObject value) { List.Remove(value); }
public void PublishDelete(AnObject anObject) { var anEvent = new AnObjectEvent { AnObject = anObject, Type = AnObjectEventType.Delete }; Send(anEvent); }
public void PublishChange(AnObject anObject) { var anEvent = new AnObjectEvent { AnObject = anObject, Type = AnObjectEventType.Change }; Send(anEvent); }
public void PublishAdd(AnObject value) { var anEvent = new AnObjectEvent { AnObject = value, Type = AnObjectEventType.Add }; Send(anEvent); }
public AnObject Change(int id, AnObject value) { var anObject = List.Find(id); anObject.Value = value.Value; GetPublisher().PublishChange(anObject); return anObject; }
public void Add(AnObject value) { List.Add(value); GetPublisher().PublishAdd(value); }