Beispiel #1
0
        public async Task <object> DeleteMultiple(string ids)
        {
            try
            {
                List <Panduan> panduanList = await panduanService.GetListByMultipleBahan(ids);

                if (panduanList != null && panduanList.Count > 0)
                {
                    throw new NotPermittedException("Masih terdapat panduan yang menggunakan bahan tersebut");
                }
                ExecuteResult result = await bahanService.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);
            }
        }
        public async Task <object> GetListByMultipleBahan(string bahanIds)
        {
            try
            {
                List <Panduan> panduanResponse = await panduanService.GetListByMultipleBahan(bahanIds);

                return(new
                {
                    Status = Models.APIResult.ResultSuccessStatus,
                    ListPanduan = panduanResponse
                });
            }
            catch (Exception e)
            {
                throw new InternalServerErrorException(e.Message);
            }
        }