Ejemplo n.º 1
0
        public void GetByIdNull()
        {
            SLTempsController slTemps = new SLTempsController();

            SLTemp sl = slTemps.GetById(10);

            Assert.IsNull(sl);
        }
Ejemplo n.º 2
0
        public void GetById()
        {
            SLTempsController slTemps = new SLTempsController();

            SLTemp sl = slTemps.GetById(0);

            Assert.AreEqual("Mikail", sl.FirstName);
        }
Ejemplo n.º 3
0
 public HttpResponseMessage Post([FromBody] SLTemp value)
 {
     if (slTempsList.Contains(value))
     {
         return(new HttpResponseMessage(HttpStatusCode.NotModified));
     }
     else
     {
         SLTemp addSlTemp = new SLTemp(value.FirstName, value.LastName);
         addSlTemp.Id = nextId + 1;
         slTempsList.Add(addSlTemp);
         return(new HttpResponseMessage(HttpStatusCode.OK));
     }
 }
Ejemplo n.º 4
0
        public void PutSLTemp(int id, [FromBody] SLTemp value)
        {
            // FindIndex Finder den ønskende element der passer den kriterie man har sat
            int index = slTempsList.FindIndex(sltemp => sltemp.Id == id);

            // Ersatter element med det man ønsker
            slTempsList[index] = value;

            //Delete and insert new customer with the old ID
            //The position in the list is changed to the be the last one
            //Customer oldCustomer = DeleteCustomer(id);
            //if (oldCustomer != null)
            //{
            //    customer.ID = oldCustomer.ID;
            //    cList.Add(customer);
            //}
            //return GetCustomer(id);
        }