Esempio n. 1
0
        public IResult Add(Model model)
        {
            var result = _modelDal.GetAll(m => m.ModelName == model.ModelName);

            if (result.Count != 0)
            {
                return(new ErrorResult(Messages.ModelAlreadyExist));
            }
            _modelDal.Add(model);
            return(new SuccessResult(Messages.AddedModel));
        }
Esempio n. 2
0
 public IDataResult <List <Model> > GetAll()
 {
     if (DateTime.Now.Hour == 22)
     {
         return(new ErrorDataResult <List <Model> >(Messages.MaintenanceTime));
     }
     return(new SuccessDataResult <List <Model> >(_modelDal.GetAll()));
 }
Esempio n. 3
0
        public IDataResult <List <Model> > GetAll()
        {
            var result = _modelDal.GetAll();

            if (result.Count > 0)
            {
                return(new SuccessDataResult <List <Model> >(result, Messages.ModelsListed));
            }
            return(new ErrorDataResult <List <Model> >(Messages.NoModelToList));
        }
        public IDataResult <List <Model> > GetAll()
        {
            var result = _modelDal.GetAll();

            if (result.Count() > 0)
            {
                return(new SuccessDataResult <List <Model> >(result));
            }
            return(new ErrorDataResult <List <Model> >(result, ModelMessages.FailedModelListed));
        }
Esempio n. 5
0
        private IDataResult <List <Model> > CheckIfModelCountEqualsZero()
        {
            var result = _modelDal.GetAll();

            if (result.Count == 0)
            {
                return(new ErrorDataResult <List <Model> >(Messages.CountEqualsZero));
            }

            return(new SuccessDataResult <List <Model> >(result));
        }
Esempio n. 6
0
 public IDataResult <List <Model> > GetAll()
 {
     return(new SuccessDataResult <List <Model> >(_modelDal.GetAll(), Messages.Listed));
 }
 public IDataResult <List <Model> > GetByBrandId(int brandId)
 {
     return(new SuccessDataResult <List <Model> >(_modelDal.GetAll(model => model.BrandId == brandId)));
 }
Esempio n. 8
0
 public IDataResult <IList <Model> > GetAll(Expression <Func <Model, bool> > filter = null)
 {
     return(new SuccessDataResult <IList <Model> >(_modelDal.GetAll(filter)));
 }