public void Delete(EquipmentDTO equipment) { IWindowManager manager = new WindowManager(); EquipmentService.Delete(equipment); Reload(); }
public HttpResponseMessage Delete(string id) { return(Execute(session => { EquipmentService.Delete(id); return Request.CreateResponse(HttpStatusCode.NoContent); })); }
public void WhenEquipmentNotExists_ShouldThrowException(int id) { using (var factory = new SqlLiteDbContextFactory()) { using (var context = factory.CreateContext()) { var service = new EquipmentService(context); Assert.Throws <Exception>(() => service.Delete(id)); } } }
public HttpResponseMessage Delete(int id) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <int> response = new ItemResponse <int>(); response.Item = _svc.Delete(id); return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse())); }
public void Delete(EquipmentDTO equipment) { IWindowManager manager = new WindowManager(); DeleteConfirmationViewModel modify = new DeleteConfirmationViewModel(); bool?showDialogResult = manager.ShowDialog(modify, null, null); if (showDialogResult != null && showDialogResult == true) { EquipmentService.Delete(equipment); } Reload(); }
public void TestDelete() { var equipmentVO = new EquipmentVO() { Name = "name1", NextControlDate = new System.DateTime(2020, 06, 06), Picture = new byte[0], SerialNumber = 1 }; _equipmentService.Delete(equipmentVO); _mockEquipmentRepository.Verify(m => m.Remove(It.IsAny <Equipment>()), Times.Once()); }
public ActionResult Delete(Guid id) { try { string imagePath = Request.MapPath($"/Content/Images/{id}.jpg"); if (System.IO.File.Exists(imagePath)) { System.IO.File.Delete(imagePath); } EquipmentService.Delete(id); } catch (NotFoundException) { return(HttpNotFound()); } catch (HasRelationsException) { return(Content("Удаление невозможно.")); } return(RedirectToAction("Index")); }
public void WhenEquipmentExists_ShouldDeleteEquipment(int id) { using (var factory = new SqlLiteDbContextFactory()) { using (var context = factory.CreateContext()) { SetupTestData(context); var service = new EquipmentService(context); service.Delete(id); var deletedEquipment = service.FindById(id); Assert.Null(deletedEquipment); } } }
public bool Delete(string id) { return(Equipment.Delete(id)); }