Ejemplo n.º 1
0
            public PlaceGarmentScrapDestinationCommandValidator(IStorage storage)
            {
                IGarmentScrapDestinationRepository _garmentScrapDestinationRepository = storage.GetRepository <IGarmentScrapDestinationRepository>();

                RuleFor(r => r.Code).Must((c) =>
                {
                    var a = _garmentScrapDestinationRepository.Find(s => s.Code == c);
                    return(a == null || a.Count < 1);
                }).WithMessage("Kode Tujuan Barang sudah di input").When(s => s.Code != null);
                RuleFor(r => r.Code).NotNull().WithMessage("Kode Tujuan Barang Aval harus diisi");
                RuleFor(r => r.Name).Must((c) =>
                {
                    var a = _garmentScrapDestinationRepository.Find(s => s.Name == c);
                    return(a == null || a.Count < 1);
                }).WithMessage("Nama Tujuan Barang sudah ada").When(s => s.Name != null);
                RuleFor(r => r.Name).NotNull().WithMessage("Nama Tujuan Barang Aval harus diisi");
            }
Ejemplo n.º 2
0
        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 = _garmentScrapDestinationRepository.Read(page, size, order, keyword, filter);
            var count = query.Count();

            List <GarmentScrapDestinationDto> listDtos = _garmentScrapDestinationRepository
                                                         .Find(query)
                                                         .Select(data => new GarmentScrapDestinationDto(data))
                                                         .ToList();

            await Task.Yield();

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