public void GetByIdNull() { SLTempsController slTemps = new SLTempsController(); SLTemp sl = slTemps.GetById(10); Assert.IsNull(sl); }
public void GetById() { SLTempsController slTemps = new SLTempsController(); SLTemp sl = slTemps.GetById(0); Assert.AreEqual("Mikail", sl.FirstName); }
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)); } }
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); }