示例#1
0
        // 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));
        }
示例#2
0
        // 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));
        }
示例#3
0
        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);
        }
示例#4
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"));
        }
示例#5
0
 // POST: api/UAN
 public IHttpActionResult Post(UAN value)
 {
     UANlist.Add(value);
     value.ID = UANlist.Count;
     return(Ok(value));
 }