// DELETE: api/IDProofType/5 public IHttpActionResult Delete(int id) { IDProofType result = IDProofTypeList.Where(p => p.ID == id).FirstOrDefault(); var resultflag = IDProofTypeList.Remove(result); return(Ok(resultflag)); }
// PUT: api/IDProofType/5 public IHttpActionResult Put(int id, IDProofType value) { IDProofType result = IDProofTypeList.Where(p => p.ID == id).FirstOrDefault(); result = value; return(Ok(result)); }
public void PostIDProofType() { // Arrange IDProofTypeController controller = new IDProofTypeController(); IDProofType IDProofTypeObj = new IDProofType { Name = "PAN" }; var actResult = controller.Post(IDProofTypeObj); // Act var result = actResult as OkNegotiatedContentResult <IDProofType>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.ID > 0); }
public void PutIDProofType() { // Arrange IDProofTypeController controller = new IDProofTypeController(); IDProofType IDProofTypeObj = new IDProofType { ID = 1, Name = "Put request sucessfull", }; var actResult = controller.Put(1, IDProofTypeObj); // Act var result = actResult as OkNegotiatedContentResult <IDProofType>; // Assert Assert.IsNotNull(result); Assert.IsTrue(result.Content.Name.Equals("Put request sucessfull")); }
// POST: api/IDProofType public IHttpActionResult Post(IDProofType value) { IDProofTypeList.Add(value); value.ID = IDProofTypeList.Count; return(Ok(value)); }