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 RemoveGarmentScrapSourceCommandHandler(IStorage storage) { _storage = storage; _garmentScrapSourceRepository = storage.GetRepository <IGarmentScrapSourceRepository>(); }
public GarmentScrapSourceController(IServiceProvider serviceProvider) : base(serviceProvider) { _garmentScrapSourceRepository = Storage.GetRepository <IGarmentScrapSourceRepository>(); }