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)); }
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); }