public IResult Add(Model model) { //ValidationTool.Validate(new ModelValidator(), model); _modelDal.Add(model); return(new SuccessDataResult <Model>(Messages.DataAdded)); }
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)); }
public IResult Add(Model model) { if (DateTime.Now.Hour == 22) { return(new ErrorResult(Messages.MaintenanceTime)); } else if (model.Name.Length < 2) { return(new ErrorResult(Messages.ModelNameInvalid)); } _modelDal.Add(model); return(new SuccessResult(Messages.ModelAdded)); }
public IResult Add(Model model) { var normalizedName = model.Name.ToUpper(); var result = BusinessRules.Run(CheckModelNameExist(normalizedName)); if (result != null) { return(result); } model.NormalizedName = normalizedName; _modelDal.Add(model); return(new SuccessResult(Messages.Added)); }
public IResult Add(Model model) { _modelDal.Add(model); return(new SuccessResult(Messages.Added)); }
public IResult Add(Model model) { _modelDal.Add(model); return(new SuccessResult()); }
public Model AddModel(Model model) { _modelDal.Add(model); return(model); }