コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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)));
        }