public ActionResult Delete(int equipmentId) { var findEquipmentType = _EquipmentRepository.Equipments.Single(row => row.EquipmentId == equipmentId); _EquipmentRepository.DeleteEquipment(findEquipmentType); return(Redirect("Index")); }
public async Task <bool> DeleteEquipment(int id) { if (await _repository.DeleteEquipment(id)) { return(true); } throw new NotImplementedException(); }
public void DeleteEquipment(EquipmentDTO dto) { try { log.Debug(EquipmentDTO.FormatEquipmentDTO(dto)); R_Equipment t = EquipmentDTO.ConvertDTOtoEntity(dto); // delete Repository.DeleteEquipment(t); dto.IsDeleted = t.IsDeleted; log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public ResponseWrapper <object> DeleteEquipment(int equipmentId) { try { if (!equipmentRepository.IsId(equipmentId)) { return(new ResponseWrapper <object>("Error 404: No such record", false)); } equipmentRepository.DeleteEquipment(equipmentId); equipmentRepository.Save(); return(new ResponseWrapper <object>("OK", true)); } catch (Exception e) { return(new ResponseWrapper <object>(e.Message, false)); } }
public async Task <bool> DeleteEquipmentSV(int id) { try { bool check = await _equipment.DeleteEquipment(id); if (check == true) { return(true); } else { return(false); } } catch (DbUpdateException) { throw; } }
public IActionResult Delete(int equipmentId) { EquipmentDeleteDto equipmentDeleteDto = new EquipmentDeleteDto { Id = equipmentId }; var userIdString = User.FindFirst(ClaimTypes.Name)?.Value; var userId = int.Parse(userIdString); equipmentDeleteDto.UserId = userId; var validationResult = _equipmentDeleteDtoValidator.Validate(equipmentDeleteDto); if (!validationResult.IsValid) { return(BadRequest(ValidationHelpers.ConvertValidationResult(validationResult))); } _equipmentRepository.DeleteEquipment(equipmentId); return(Ok()); }
public async Task <IActionResult> Delete(int employeeId, int Id) { try { var Equipment = await _repository.GetEquipmentAsync(employeeId, Id); if (Equipment == null) { return(NotFound()); } if (await _repository.DeleteEquipment(Equipment)) { return(Ok()); } } catch (Exception e) { _logger.LogError(e, e.Message); return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } return(BadRequest("Failed to delete the Equipment")); }
public Task <bool> DeleteEquipment([FromQuery] int equipmentId) { return(_repo.DeleteEquipment(equipmentId)); }
public IActionResult DeleteEquipment(int Id) { _equipmentRepository.DeleteEquipment(Id); return(RedirectToAction("Index")); }
public void DeleteEquipment(int id) { _equipmentRepository.DeleteEquipment(id); }
public async Task DeleteEquipment(Guid id) { await _equipmentRepository.DeleteEquipment(id); }