public UpdateGarmentScrapSourceCommandValidator(IStorage storage)
            {
                IGarmentScrapSourceRepository _garmentScrapSourceRepository = storage.GetRepository <IGarmentScrapSourceRepository>();

                RuleFor(r => r.Code).Must((c) =>
                {
                    var a = _garmentScrapSourceRepository.Find(s => s.Code == c);
                    return(a == null || a.Count < 1);
                }).WithMessage("Kode Asal Barang sudah ada").When(s => s.Code != null);
                RuleFor(r => r.Code).NotNull().WithMessage("Kode Asal Barang Aval harus diisi");
                RuleFor(r => r.Name).Must((c) =>
                {
                    var a = _garmentScrapSourceRepository.Find(s => s.Name == c);
                    return(a == null || a.Count < 1);
                }).WithMessage("Nama Asal Barang sudah ada").When(s => s.Name != null);
                RuleFor(r => r.Name).NotNull().WithMessage("Nama Asal Barang Aval harus diisi");
            }
        public async Task <IActionResult> Get(int page = 1, int size = 25, string order = "{}", [Bind(Prefix = "Select[]")] List <string> select = null, string keyword = null, string filter = "{}")
        {
            VerifyUser();

            var query = _garmentScrapSourceRepository.Read(page, size, order, keyword, filter);
            var count = query.Count();

            List <GarmentScrapSourceDto> listDtos = _garmentScrapSourceRepository
                                                    .Find(query)
                                                    .Select(data => new GarmentScrapSourceDto(data))
                                                    .ToList();

            await Task.Yield();

            return(Ok(listDtos, info: new
            {
                page,
                size,
                count
            }));
        }