public void DeleteRawMaterial(DeleteRawMaterialInput input) { var rawmaterial = _RawMaterialRepository.Get(input.Id); rawmaterial.IsDeleted = true; _RawMaterialRepository.Delete(rawmaterial); }
public IActionResult BulkDelete(string ids) { try { var arrayIds = ids.Split(","); if (arrayIds.Length == 0) { return new ResponseResult(Response) { StatusCode = (int)StatusCodes.Status400BadRequest, ErrorMessage = "Deleting failed. No record was selected" } } .ToJsonResult(); _repository.Delete(arrayIds); return(Ok($"Successfully Deleted {arrayIds.Length} records.")); }
public IActionResult Delete(long id) { try { var model = repository.Get().Where(a => a.RawMaterialId == id).ToList().FirstOrDefault(); if (model == null) { return(BadRequest(Constants.ErrorMessages.NotFoundEntity)); } repository.Delete(model); return(Accepted(Constants.ErrorMessages.DeleteSucess(1))); } catch (Exception ex) { logger.LogError(ex.GetExceptionMessages()); return(StatusCode(StatusCodes.Status500InternalServerError, Constants.ErrorMessages.DeleteError)); } }