Пример #1
0
        public async Task <object> DeleteMultiple(string ids)
        {
            try
            {
                List <Bahan> bahanList = await bahanService.GetListByMultipleKategori(ids);

                if (bahanList != null && bahanList.Count > 0)
                {
                    throw new NotPermittedException("Masih ada bahan yang memakai kategori tersebut");
                }
                ExecuteResult result = await kategoriBahanService.DeleteMultiple(ids);

                if (result.ReturnVariable <= 0)
                {
                    throw new InternalServerErrorException("An error has occured");
                }
                return(new
                {
                    Status = Models.APIResult.ResultSuccessStatus,
                    ReturnValue = result.ReturnVariable
                });
            }
            catch (NotPermittedException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new InternalServerErrorException(e.Message);
            }
        }