Esempio n. 1
0
        public async Task <IActionResult> Create(FrontProcessNewProcessWithMaster Fields)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var testifallowed = new FrontProcessNewProcessLogic(_userProvider, _processProvider, _frontProcessProvider);

            Fields.UserId = CurrentUser.Id;
            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))              //11
            {
                //Check if the template is allowed to be created
                var Condition = await testifallowed.ReturnProcessTypeList(CurrentUser);

                var Pass = await testifallowed.ReturnProcessTypeFlowPass(CurrentUser, Fields);

                if (Condition.Any(x => x.ProcessTypeId == Fields.ProcessTypeId) && Pass != 0)
                {
                    Fields.ProcessTypeFlowId = Pass;
                    _frontProcessProvider.FrontProcessCreatePost(Fields);
                    return(Ok(Fields));// CurrentUser.LanguageId));
                }
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }