コード例 #1
0
        public async Task <IActionResult> Delete(PersonRelationTypeDeleteGet PersonRelationType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                PersonRelationType.UserId = CurrentUser.Id;
                //var CheckString = await _PersonRelationTypeProvider.DeletePostCheck(PersonRelationType);
                //if (CheckString.Length == 0)
                //{
                _personRelationTypeProvider.DeletePost(CurrentUser.Id, PersonRelationType.PersonRelationTypeId);
                return(Ok(PersonRelationType));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
コード例 #2
0
        public async Task <IActionResult> Delete(PersonRelationTypeDeleteGet Page)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            await _client.PostProtectedAsync <PersonRelationTypeDeleteGet>($"{_configuration["APIUrl"]}api/PersonRelationType/Delete", Page, token);

            //return RedirectToAction("Index", new { id = UserMenu.UserMenuTemplateId });
            return(RedirectToAction("Index"));
        }