public void DeleteEquipment() { var equipmentTodel = equipmentRepository.GetEquipmentById(2); var equipmentTodel1 = equipmentRepository.GetEquipmentByEquipmentType(EquipmentType.Table); Assert.That(equipmentTodel, !Is.Null); Assert.That(equipmentTodel1, !Is.Null); Assert.IsTrue(equipmentRepository.Delete(equipmentTodel), "Something go wrong"); Assert.IsTrue(equipmentRepository.Delete(equipmentTodel1), "Something go wrong"); contextManager.BatchSave(); }
public void Delete(Guid equipmentId) { _unitOfWork.BeginTransaction(); _equipmentRepository.Delete(equipmentId); _unitOfWork.Commit(); }
/// <summary> /// 修改数据仓库 model.OpSign = add/edit/delete /// </summary> /// <param name="listModel"></param> /// <returns></returns> public OpResult Store(List <EquipmentModel> listModel) { int record = 0; string opContext = "设备档案", opSign = string.Empty; OpResult opResult = OpResult.SetErrorResult("未执行任何操作!"); if (listModel == null || listModel.Count <= 0) { return(OpResult.SetErrorResult("集合不能为空!")); } opSign = listModel[0].OpSign; if (opSign.IsNullOrEmpty()) { return(OpResult.SetErrorResult("操作模式不能为空!")); } try { switch (opSign) { case OpMode.Add: //新增 listModel.ForEach(model => { record += irep.Insert(model); }); opResult = record.ToOpResult_Add(opContext); break; case OpMode.Edit: //修改 listModel.ForEach(model => { record += irep.Update(u => u.Id_Key == model.Id_Key, model); }); opResult = record.ToOpResult_Eidt(opContext); break; case OpMode.Delete: //删除 listModel.ForEach(model => { record += irep.Delete(model.Id_Key); }); opResult = record.ToOpResult_Delete(opContext); break; default: opResult = OpResult.SetErrorResult("操作模式溢出!"); break; } } catch (Exception ex) { throw new Exception(ex.InnerException.Message); } return(opResult); }
public async Task <ApiResult <bool> > DeleteAsync(int id) { _logger.LogInformation(_localizer["LogMethodCalled", "api/Equipment/Delete"]); ApiResult <bool> response = await _equipmentRepository.Delete(id); _logger.LogInformation(_localizer["LogMethodResult", "api/Equipment/Delete", response.Deserialize()]); return(response); }
public IActionResult Delete(int id) { var isRemoved = _repo.Delete(id); if (!isRemoved) { return(NotFound()); } return(RedirectToAction("Index")); }
public Equipment Delete(DeleteEquipmentCommand command) { var equipment = _repository.GetById(command.IdEquipment); equipment.Delete(); _repository.Delete(equipment); if (Commit()) { return(equipment); } return(null); }
/// <summary> /// The Delete /// </summary> /// <param name="entity">The entity<see cref="Equipment"/></param> /// <returns>The <see cref="ServiceResult"/></returns> public ServiceResult Delete(Equipment entity) { try { _repository.Delete(entity); return(new ServiceResult(true)); } catch (Exception ex) { return(new ServiceResult(false) { Error = ex.ToString() }); } }
public ICommandResult Handle(DeleteEquipmentCommand command) { string id = command.Id.ToString(); if (string.IsNullOrEmpty(id)) { AddNotification("Id", "Identificador inválido"); } if (Invalid) { return(new CommandResult(false, "Erro ao deletar registro", Notifications)); } _repository.Delete(command); return(new CommandResult(true, "Registro deletado com sucesos", null)); }
public void DeleteEquipment(int id) { _equipmentRepository.Delete(id); }
public async Task DeleteAndSave(long Id) { _equipmentRepo.Delete(Id); await _equipmentRepo.Save(); }
public void DeleteForm(string keyValue) { service.Delete(t => t.FId == keyValue); }
public void Delete(Equipment entity) { roomService.DeleteEquipmentFromRooms(entity); _repository.Delete(entity); }