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

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

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

            return(RedirectToAction("Index", new { id = OrganizationAddress.OrganizationId }));
        }