// DELETE: api/UAN/5 public IHttpActionResult Delete(int id) { UAN result = UANlist.Where(p => p.ID == id).FirstOrDefault(); var resultflag = UANlist.Remove(result); return(Ok(resultflag)); }
// PUT: api/UAN/5 public IHttpActionResult Put(int id, UAN value) { UAN result = UANlist.Where(p => p.ID == id).FirstOrDefault(); result.Number = value.Number; result.Status = value.Status; result.FromESPL = value.FromESPL; result.Comments = value.Comments; return(Ok(result)); }
public void PostUAN() { // Arrange UANController controller = new UANController(); UAN UANObj = new UAN { Number = "123456", Comments = "Good Work", }; var actResult = controller.Post(UANObj); // Act var result = actResult as OkNegotiatedContentResult <UAN>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.ID > 0); }
public void PutUAN() { // Arrange UANController controller = new UANController(); UAN UANObj = new UAN { Number = "Put request sucessfull", Comments = "Good Work", ID = 1 }; var actResult = controller.Put(1, UANObj); // Act var result = actResult as OkNegotiatedContentResult <UAN>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.Number.Equals("Put request sucessfull")); }
// POST: api/UAN public IHttpActionResult Post(UAN value) { UANlist.Add(value); value.ID = UANlist.Count; return(Ok(value)); }