示例#1
0
        public void DeleteRawMaterial(DeleteRawMaterialInput input)
        {
            var rawmaterial = _RawMaterialRepository.Get(input.Id);

            rawmaterial.IsDeleted = true;
            _RawMaterialRepository.Delete(rawmaterial);
        }
示例#2
0
        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."));
            }
示例#3
0
        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));
            }
        }