Ejemplo n.º 1
0
        public async Task <IActionResult> Delete(PropertyValueDeleteGet PropertyValue)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                //var CheckString = await _PropertyValueProvider.DeletePostCheck(PropertyValue);
                //if (CheckString.Length == 0)
                //{
                _propertyValueProvider.DeletePost(CurrentUser.Id, PropertyValue.PropertyValueId);
                return(Ok(PropertyValue));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(PropertyValueDeleteGet PropertyValue)
        {
            var token = HttpContext.Session.GetString("Token");

            if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            await _client.PostProtectedAsync <PropertyValueDeleteGet>($"{_configuration["APIUrl"]}api/PropertyValue/Delete", PropertyValue, token);

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