Beispiel #1
0
        /// <summary>
        ///删除爱好
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> Delete(Guid id)
        {
            var user = await _hobbyExtension.GetSingleAsyn(x => x.ID == id);

            _hobbyExtension.DeleteAndSave(user);
            return(Json(true));
        }
        public async Task <IActionResult> Delete(Guid id)
        {
            var user = await _userExtension.GetSingleAsyn(x => x.Id == id.ToString());

            _userExtension.DeleteAndSave(user);
            return(Json(new { isOK = true, message = user.Name + "删除成功" }));
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> Delete(Guid id)
        {
            var entity = await _homeExhibitionRepository.GetAll().Where(x => x.ID == id).FirstOrDefaultAsync();

            _homeExhibitionRepository.DeleteAndSave(entity);
            return(Json(new { isOK = true, message = "删除成功" }));
        }
        /// <summary>
        /// 删除评论
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> DeleteComment(Guid id)
        {
            var entity = await _commonExtension.GetAll().Where(x => x.ID == id).FirstOrDefaultAsync();

            _commonExtension.DeleteAndSave(entity);
            return(Json(new { isOK = true, message = "删除评论成功" }));
        }
Beispiel #5
0
        /// <summary>
        /// 删除活动图片
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> DeleteActivityDetailedImages(Guid id)
        {
            var entity = await _businessImageExtension.GetAll().Where(x => x.ID == id).FirstOrDefaultAsync();

            _businessImageExtension.DeleteAndSave(entity);
            return(Json(new { isOk = true }));
        }
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> DeleteActivityRecord(Guid id)
        {
            var entity = await _activityTermExtension.GetAll().Include(x => x.User).Where(x => x.ID == id).FirstOrDefaultAsync();

            if (entity.User.Id != User.Claims.FirstOrDefault().Value)
            {
                return(Json(new { isOK = false, message = "删除失败,您没有权限操作" }));
            }
            if (entity == null)
            {
                return(Json(new { isOK = false, message = "删除失败,请联系管理员" }));
            }
            _activityTermExtension.DeleteAndSave(entity);
            return(Json(new { isOK = true, message = "删除历史活动成功" }));
        }
        /// <summary>
        /// 取消活动
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> CancelActivity(Guid id)
        {
            var user = User.Claims.FirstOrDefault();

            if (user == null)
            {
                return(Json(new { isOK = false, message = "请登录!!!" }));
            }
            var entity = _activityUserExtension.GetAll().Include(x => x.ActivityTerm).Include(x => x.ActivityTerm.User)
                         .Where(x => x.User.Id == user.Value && x.ActivityTermId == id).FirstOrDefault();

            if (entity == null)
            {
                return(Json(new { isOK = false, message = "你已经加入该活动,不可重复加入" }));
            }
            ;
            _activityUserExtension.DeleteAndSave(entity);
            var userInfo = await _userManager.FindByIdAsync(user.Value);

            await AddMessageNotification(entity.ActivityTerm.User, id, entity.ActivityTerm.Name, userInfo.Name + "取消活动:" + userInfo.Name, BusinessEmergencyEnum.一般);

            return(Json(new { isOK = true, message = "取消成功" }));
        }
Beispiel #8
0
        /// <summary>
        /// 退出社团
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> CancelAnAssociation(Guid id)
        {
            var user = User.Claims.FirstOrDefault();

            if (user == null)
            {
                return(Json(new { isOK = false, message = "请登录!!!" }));
            }

            var entityUser = _anAssociationAndUserExtension.GetAll().Include(x => x.User).Include(x => x.AnAssociation).Include(x => x.AnAssociation.User)
                             .Where(x => x.User.Id == user.Value && x.AnAssociationId == id).FirstOrDefault();

            if (entityUser == null)
            {
                return(Json(new { isOK = false, message = "你不是该社团成员" }));
            }
            var userInfo = await _userManager.FindByIdAsync(user.Value);

            _anAssociationAndUserExtension.DeleteAndSave(entityUser);
            await AddMessageNotification(entityUser.AnAssociation.User, id, entityUser.AnAssociation.Name, userInfo.Name + "退出社团:" + entityUser.AnAssociation.Name, BusinessEmergencyEnum.一般);

            return(Json(new { isOK = true, message = "成功退出" }));
        }