示例#1
0
        public override async Task <BusinessLogicEntity> Action(BusinessLogicEntity dto)
        {
            var entity = dto as Brand;

            if ((await _data.GetBrand(entity.id)) != null)
            {
                AddError(string.Format("Brand with Id={0} already exists", entity.id));
                return(null);
            }
            return(await _data.CreateBrand(entity));
        }
示例#2
0
        public override async Task <BusinessLogicEntity> Action(BusinessLogicEntity dto)
        {
            var entity = dto as Brand;

            if ((await _data.GetBrand(entity.id)) == null)
            {
                AddError(string.Format("Brand with Id={0} doesn't exist", entity.id));
                return(null);
            }
            await _data.DeleteBrand(entity);

            return(entity);
        }
        public override async Task <BusinessLogicEntity> Action(BusinessLogicEntity dto)
        {
            var task = await Task.Run(() =>
            {
                TestModel entity = dto as TestModel;
                if (entity.is_unrecoverable)
                {
                    AddError("Action error encountered");
                }
                return(entity);
            });

            return(task);
        }
示例#4
0
        public void Save(BusinessLogicEntity entity)
        {
            var existingDbModel = _databaseModels.SingleOrDefault(x => x.Property == entity.Property);

            if (existingDbModel == null)
            {
                _databaseModels.Add(
                    new DatabaseModel {
                    Property = entity.Property
                }
                    );
            }
            else
            {
                existingDbModel.Property = entity.Property;
            }
        }
 public void Save(BusinessLogicEntity entity)
 {
     _businessLogicRepository.Save(entity);
 }