Esempio n. 1
0
 public async Task <ActionResult <object> > Delete([FromBody] ManageEntityRequest request)
 {
     if (!_permissionService.IsAllowed(new ActionRequestInfo(HttpContext, _implementationsContainer, request.EntityType, ActionTypeEnum.Delete)))
     {
         return(Unauthorized());
     }
     return(await _entityHandler.Delete(request));
 }
        /// <summary>
        /// 删除此记录
        /// </summary>
        /// <returns></returns>
        public virtual bool Delete(IDataBaseHandler handler)
        {
            ORMContext ctx = new ORMContext(handler.DbContext.ConnectionInfo);
            IEntityHandler <EntityBase> hand = ctx.CreateHandler <EntityBase>(this, handler);
            int i = hand.Delete();

            return(i > 0);
        }
        public async Task <Result <object> > Delete(ManageEntityRequest request)
        {
            using (var repository = _implementations.GetBusinessRepository())
            {
                var result = await _entityHandler.Delete(request, repository);

                await _entityHandler.SaveChanges(repository, request.EntityTypeName);

                return(result);
            }
        }