public void ListAllDptTest() { var ops = new DepartmentOperations(); var response = ops.ListAllDepartments(); Assert.IsTrue(response.Success); Assert.AreEqual(8, response.Data.Count); }
public void GetSingleDptTest() { var ops = new DepartmentOperations(); var response = ops.GetSingleDpt(5); Assert.IsTrue(response.Success); Assert.AreEqual("Human Resources", response.Data.DepartmentName); }
// GET api/<controller> public List <Departments> Get() { var ops = new DepartmentOperations(); var response = ops.ListAllDepartments(); var list = response.Data; return(list); }
public void CreateDptTest() { var ops = new DepartmentOperations(); ops.CreateDepartment("Customer Service"); var ptoList = ops.ListAllDepartments(); var newDpt = ptoList.Data.FirstOrDefault(x => x.DepartmentID == 8); Assert.AreEqual("Customer Service", newDpt.DepartmentName); }
public List <SelectListItem> GenerateDepartmentList() { var ops = new DepartmentOperations(); var response = ops.ListAllDepartments(); var listDpt = response.Data; var dptVM = new DepartmentsVM(); dptVM.GenerateListOfDpts(listDpt); List <SelectListItem> dptSelectListItem = dptVM.DepartmentNames; return(dptSelectListItem); }
// POST api/<controller> public HttpResponseMessage Post(Departments department) { var ops = new DepartmentOperations(); ops.CreateDepartment(department.DepartmentName); var opsResponse = ops.GetDptIdByName(department.DepartmentName); int dptId = opsResponse.Data; var response = Request.CreateResponse(HttpStatusCode.Created, department.DepartmentName); string uri = Url.Link("DefaultApi", new { id = dptId }); response.Headers.Location = new Uri(uri); return(response); }
// DELETE api/<controller>/5 public void Delete(int id) { var ops = new DepartmentOperations(); ops.DeleteDepartment(id); }
// PUT api/<controller>/5 public void Put(Departments department) { var ops = new DepartmentOperations(); ops.UpdateDepartment(department); }