public void removeObject_objWithChild_willThrows() { BizEntityHelper o = new BizEntityHelper(db); BizEntity bizEntity = o.createObject(); bizEntity.name = "Integration_Test_XXXYYYZZZ"; OrgSchema orgSchema = db.orgSchemas.FirstOrDefault(); BizEntity bizParentEntity = orgSchema. bizEntityRelationOnOrgSchemas.FirstOrDefault().bizEntityChild; o.saveCreatedObject(orgSchema, bizEntity, bizParentEntity); Assert.Throws <DataLogicException>( () => o.removeObject(bizParentEntity.bizEntityId)); }
public void removeObject_obj_willSetVibleToFalse() { BizEntityHelper o = new BizEntityHelper(db); BizEntity bizEntity = o.createObject(); bizEntity.name = "Integration_Test_XXXYYYZZZ"; OrgSchema orgSchema = db.orgSchemas.FirstOrDefault(); BizEntity bizParentEntity = orgSchema. bizEntityRelationOnOrgSchemas.FirstOrDefault().bizEntityChild; o.saveCreatedObject(orgSchema, bizEntity, bizParentEntity); o.removeObject(bizEntity.bizEntityId); Assert.False(bizEntity.isVisible); }
public IHttpActionResult Delete(int id) { var obj = db.bizEntities.Find(id); if (obj == null) { return(NotFound()); } var bizEntityHelper = new BizEntityHelper(db); try { //OrgMgmtDBHelper.removeBizEntity(id, db); bizEntityHelper.removeObject(id); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(bizEntityHelper.convert2DTO(obj))); }