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();
            }
        }
Exemple #3
0
 internal void Add(AnObject value)
 {
     value.Id = ++_inc;
     List.Add(value);
 }
Exemple #4
0
 internal void Remove(AnObject value)
 {
     List.Remove(value);
 }
Exemple #5
0
 public void PublishDelete(AnObject anObject)
 {
     var anEvent = new AnObjectEvent
     {
         AnObject = anObject,
         Type = AnObjectEventType.Delete
     };
     Send(anEvent);
 }
Exemple #6
0
 public void PublishChange(AnObject anObject)
 {
     var anEvent = new AnObjectEvent
     {
         AnObject = anObject,
         Type = AnObjectEventType.Change
     };
     Send(anEvent);
 }
Exemple #7
0
 public void PublishAdd(AnObject value)
 {
     var anEvent = new AnObjectEvent
         {
         AnObject = value,
         Type = AnObjectEventType.Add
     };
     Send(anEvent);
 }
Exemple #8
0
 public AnObject Change(int id, AnObject value)
 {
     var anObject = List.Find(id);
     anObject.Value = value.Value;
     GetPublisher().PublishChange(anObject);
     return anObject;
 }
Exemple #9
0
 public void Add(AnObject value)
 {
     List.Add(value);
     GetPublisher().PublishAdd(value);
 }