public IHttpActionResult Delete(string id) { try { DepartmentViewModel dep = new DepartmentViewModel(); dep.GetById(id); if (dep.Delete()) return Ok(dep.Delete()); else return BadRequest("Could not delete"); } catch (Exception ex) { return BadRequest("Delete failed - " + ex.Message); } }
public void DepartmentVMCreateAndDeleteShouldReturnTrue() { bool deleteOK = false; DepartmentViewModel vm = new DepartmentViewModel(); vm.DepartmentName = "Coder"; vm.Create(); if (vm.Id.Length == 24) deleteOK = vm.Delete(); Assert.IsTrue(deleteOK); }