コード例 #1
0
        public async Task <ActionResult> Edit(short id)
        {
            var data = new LinkBuildingViewModel();

            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    //Call API Provider
                    string strUrl = controllerName + APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    data = await APIProvider.Authorize_Get <LinkBuildingViewModel>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    //var list = await APIProvider.Get<List<LinkBuildingViewModel>>(controllerName);
                }
                return(View(data));
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #2
0
        public async Task <ActionResult> Details(int id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                ArticlesModel model   = new ArticlesModel();
                var           article = await GetArticle(id);

                var comments = await GetComments(id);

                model.ArticleViewModel       = article;
                model.lstArticleCommentModel = comments;

                model.ArticleCommentModel = new ArticleCommentViewModel()
                {
                    CreatedUser = _userSession.UserId,
                    ArticleId   = id
                };
                return(View(model));
            }
        }
コード例 #3
0
        public async Task <ActionResult> Edit(short id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Module, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var model = new ModuleViewModel();
                try
                {
                    //Call API Provider
                    string action = "Get";
                    var    list   = await APIProvider.Authorize_Get <List <ModuleViewModel> >(_userSession.BearerToken, controllerName, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                    string strUrl = controllerName + '/' + action + '/' + id;
                    model = await APIProvider.Authorize_Get <ModuleViewModel>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);


                    ViewBag.Modules = list.Where(x => x.Id != id && x.Group == model.Group);
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex);
                    throw ex;
                }
                return(View(model));
            }
        }
コード例 #4
0
        public async Task <ActionResult> Edit(Guid id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Permission, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var model = new PermissionViewModel();
                try
                {
                    var token = _userSession.BearerToken;
                    controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                    //Call API Provider
                    string strUrl = controllerName + "/FindById?id=" + id;
                    model = await APIProvider.Authorize_Get <PermissionViewModel>(token, strUrl, APIConstant.API_Resource_Authorize);

                    if (model != null)
                    {
                        return(View(model));
                    }
                    else
                    {
                        return(View(model));
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex);
                    throw ex;
                }
            }
        }
コード例 #5
0
        public async Task <ActionResult> Edit(short id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Department, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var model = new DepartmentViewModel();
                try
                {
                    //Call API Provider
                    string strUrl = APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    model = await APIProvider.Authorize_Get <DepartmentViewModel>(_userSession.BearerToken, controllerName + strUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                    ViewBag.Img = Path.Combine(ValueConstant.IMAGE_DEPARTMENT_PATH, model.Img);
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex);
                    throw ex;
                }
                return(View(model));
            }
        }
コード例 #6
0
        public async Task <ActionResult> Delete(AdvertiseViewModel model)
        {
            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Delete))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_DELETE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(PartialView("_Delete", model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #7
0
        public async Task <ActionResult> Create()
        {
            var token = _userSession.BearerToken;

            //Check add new
            if (!await APIProvider.Authorization(token, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_INSERT);
                return(RedirectToAction("Index"));
            }

            var listRole = await APIProvider.Authorize_Get <List <RoleViewModel> >(token, ConstantDomain.GET_ROLE, APIConstant.API_Resource_Authorize, ARS.IgnoredARS);

            if (listRole != null)
            {
                ViewBag.Role = listRole;
            }
            else
            {
                ViewBag.Role = new List <RoleViewModel>();
            }

            RegisterBindingModel model = new RegisterBindingModel();

            return(View(model));
        }
コード例 #8
0
        public async Task <ActionResult> Edit(short id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.OfferAdvise, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                OfferAdviseViewModel model;
                try
                {
                    //Call API Provider
                    var strUrl = controllerName + APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    model = await APIProvider.Authorize_Get <OfferAdviseViewModel>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.Edit);

                    if (model.Tag != string.Empty)
                    {
                        ViewBag.Tags = model.Tag;
                    }
                }
                catch (Exception ex)
                {
                    Logger.LogError(ex);
                    throw ex.GetBaseException();
                }
                return(View(model));
            }
        }
コード例 #9
0
        public async Task <ActionResult> Create()
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.UserProfile, APIConstant.ACTION_INSERT);
                return(RedirectToAction("Index"));
            }
            else
            {
                string   search = string.Empty;
                UserType type   = EnumUserConstants.UserType.ISDOCTOR;
                string   apiUrl = APIProvider.APIGenerator("User", new List <string> {
                    nameof(search), nameof(type)
                }, true, search, type);
                var list = await APIProvider.Authorize_Get <List <UserViewModel> >(_userSession.BearerToken, apiUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                if (list == null)
                {
                    ViewBag.User = ApplicationGenerator.GetObject <UserViewModel>();
                }
                else
                {
                    ViewBag.User = list;
                }

                return(View());
            }
        }
コード例 #10
0
        // GET: Post/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    var listPri = new InitPriority();
                    ViewBag.Priorities = listPri.InitItemPriority();

                    //Call API Provider
                    string strUrl = APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    var    model  = await APIProvider.Authorize_Get <PostViewModel>(_userSession.BearerToken, controllerPost + strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    if (string.IsNullOrEmpty(model.Image))
                    {
                        model.Image = ValueConstant.IMAGE_PATH + ValueConstant.IMAGE_POST_PATH + ValueConstant.IMAGE_DEFAULT;
                    }
                    var listCatg = await APIProvider.Authorize_Get <List <CategoryViewModel> >(_userSession.BearerToken, controllerCategory, APIConstant.API_Resource_CMS, ARS.Get);

                    if (listCatg != null)
                    {
                        ViewBag.Categories = listCatg;
                    }
                    else
                    {
                        ViewBag.Categories = new List <CategoryViewModel>();
                    }

                    if (model.Tag != string.Empty)
                    {
                        ViewBag.Tags = model.Tag;
                    }

                    return(View(model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #11
0
        public async Task <ActionResult> ViewConfirmDelete(short id)
        {
            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Delete))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_DELETE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    //Call API Provider
                    //string strUrl = APIProvider.APIGenerator(controllerName, string.Empty, new List<string> {"id"}, id);
                    string strUrl = APIProvider.APIGenerator(controllerName, new List <string> {
                        nameof(id)
                    }, false, id);
                    var model = await APIProvider.Authorize_Get <WorkflowStateViewModel>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    if (model == null)
                    {
                        return(null);
                    }

                    strUrl = APIProvider.APIGenerator(controllerName, "CheckIsUsed", new List <string> {
                        "id"
                    }, id);
                    var checkIsUsed = await APIProvider.Authorize_Get <bool>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    if (!checkIsUsed)
                    {
                        ViewBag.IsUsed = false;
                    }
                    else
                    {
                        TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.ISUSED, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_DELETE, ApplicationGenerator.TypeResult.ISUSED));
                        ViewBag.IsUsed    = true;
                    }
                    return(PartialView("_Delete", model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #12
0
 public async Task <ActionResult> ServicesDelete(DepartmentServicesViewModel model)
 {
     if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Delete))
     {
         TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Department, APIConstant.ACTION_INSERT);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(PartialView("_ServicesDelete", model));
     }
 }
コード例 #13
0
 public async Task <ActionResult> Delete(OfferAdviseViewModel model)
 {
     if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
     {
         TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.OfferAdvise, APIConstant.ACTION_DELETE);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(PartialView("_Delete", model));
     }
 }
コード例 #14
0
        public async Task <ActionResult> Create(DepartmentViewModel model, HttpPostedFileBase fileUpload)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Department, APIConstant.ACTION_INSERT);
                return(RedirectToAction("Index"));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    if (fileUpload != null)
                    {
                        model.Img = fileUpload.FileName;
                    }

                    //Call API Provider
                    string strUrl = APIProvider.APIGenerator(controllerName, APIConstant.ACTION_INSERT);
                    var    result = await APIProvider.Authorize_DynamicTransaction <DepartmentViewModel, bool>(model, _userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.Insert);

                    if (result)
                    {
                        if (fileUpload != null)
                        {
                            FileManagement.UploadImage(fileUpload, ValueConstant.IMAGE_DEPARTMENT_PATH);
                        }

                        TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.SUCCESS, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_INSERT, ApplicationGenerator.TypeResult.SUCCESS));
                    }
                    else
                    {
                        TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.FAIL, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_INSERT, ApplicationGenerator.TypeResult.FAIL));
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    var department = new DepartmentModel();
                    department.lstDepartmentViewModel = (List <DepartmentViewModel>)TempData["Data"];

                    if (department.lstDepartmentViewModel == null)
                    {
                        department.lstDepartmentViewModel = ApplicationGenerator.GetObject <List <DepartmentViewModel> >();
                    }
                    department.DepartmentViewModel = model;

                    //TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.FAIL, ApplicationGenerator.GeneralActionMessage(ValueConstant.ACTION_INSERT, ApplicationGenerator.TypeResult.FAIL));
                    return(View("Index", department));
                }
            }
        }
コード例 #15
0
        public async Task <ActionResult> Create()
        {
            var token = _userSession.BearerToken;

            if (!await APIProvider.Authorization(token, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_INSERT);
                return(RedirectToAction("Index"));
            }
            else
            {
                ArticleViewModel model = new ArticleViewModel();
                return(View(model));
            }
        }
コード例 #16
0
        public async Task <ActionResult> Edit(int id)
        {
            //Call API Provider - Get data

            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var model = await GetArticle(id);

                return(View("Edit", model));
            }
        }
コード例 #17
0
        // GET: Post/Create
        public async Task <ActionResult> Create()
        {
            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_INSERT);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    var listPri = new InitPriority();
                    ViewBag.Priorities = listPri.InitItemPriority();

                    var model = new PostViewModel();
                    model.MetaRobotFollow = model.MetaRobotIndex = model.MetaRobotAdvanced = 1;
                    model.PublishDate     = DateTime.Now;
                    model.Status          = 1;

                    var listCatg = await APIProvider.Authorize_Get <List <CategoryViewModel> >(_userSession.BearerToken, controllerCategory, APIConstant.API_Resource_CMS, ARS.Get);

                    if (listCatg != null)
                    {
                        model.CategoryId   = listCatg.FirstOrDefault(m => m.Name == "Tin tức").Id;
                        ViewBag.Categories = listCatg;
                    }
                    else
                    {
                        ViewBag.Categories = new List <CategoryViewModel>();
                    }

                    return(View(model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #18
0
        public async Task <ActionResult> Edit(string id)
        {
            var model = new GalleryViewModel();

            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    //Call API Provider
                    string strUrl = APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    model = await APIProvider.Authorize_Get <GalleryViewModel>(_userSession.BearerToken, controllerName + strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    ViewBag.Img = Path.Combine(Path.Combine(ValueConstant.IMAGE_GALLERY_PATH, model.Id), model.Img);

                    //Departments
                    strUrl = APIProvider.APIGenerator("Department", new List <string> {
                        "type"
                    }, true, "available");
                    var departments = await APIProvider.Get <List <DepartmentViewModel> >(strUrl, APIConstant.API_Resource_CORE);

                    departments         = (departments == null ? new List <DepartmentViewModel>() : departments);
                    ViewBag.Departments = departments;

                    TempData["Departments"] = departments;

                    return(View(model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #19
0
        public async Task <ActionResult> Edit(byte id)
        {
            var model = new CategoryViewModel();

            try
            {
                if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    //Call API Provider
                    var list = await APIProvider.Authorize_Get <List <CategoryViewModel> >(_userSession.BearerToken, controllerName, APIConstant.API_Resource_CMS, ARS.Get);

                    string strUrl = controllerName + APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                    model = await APIProvider.Authorize_Get <CategoryViewModel>(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CMS, ARS.Get);

                    if (model != null)
                    {
                        if (!string.IsNullOrEmpty(model.Image) && !model.Image.Contains(ValueConstant.IMAGE_CATEGORY_PATH))
                        {
                            model.Image = ValueConstant.IMAGE_CATEGORY_PATH + "/" + model.Image;
                        }
                    }

                    ViewBag.Categories = list.Where(x => x.Id != id);
                    return(View(model));
                }
            }
            catch (HttpException ex)
            {
                Logger.LogError(ex);
                int statusCode = ex.GetHttpCode();
                if (statusCode == 401)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(FuntionType.Department, APIConstant.ACTION_ACCESS);
                    return(new HttpUnauthorizedResult());
                }

                throw ex;
            }
        }
コード例 #20
0
 public async Task <ActionResult> Delete(PostListViewModel model)
 {
     try
     {
         if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Delete))
         {
             TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_DELETE);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(PartialView("_Delete", model));
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
         throw;
     }
 }
コード例 #21
0
 public async Task <ActionResult> Approve(int id)
 {
     try
     {
         if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
         {
             TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Account, APIConstant.ACTION_UPDATE);
             return(RedirectToAction("Index"));
         }
         else
         {
             var model = new PostStateHistoryViewModel();
             model.PostId = id;
             return(PartialView("_Approve", model));
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
         throw;
     }
 }
コード例 #22
0
        public async Task <ActionResult> Edit(string id)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Survey, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var strUrl = APIProvider.APIGenerator(this, this.RouteData.Values["action"].ToString(), id);
                var model  = await APIProvider.Authorize_Get <SurveyModel>(_userSession.BearerToken, ControllerName + strUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                if (model == null)
                {
                    model = ApplicationGenerator.GetObject <SurveyModel>();
                }
                if (model.SurveyQuestionsModel == null)
                {
                    model.SurveyQuestionsModel = new List <SurveyQuestionsModel>();
                }
                return(View(model));
            }
        }
コード例 #23
0
 public async Task <ActionResult> Publish(int id)
 {
     try
     {
         if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
         {
             TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Article, APIConstant.ACTION_PUBLISH);
             return(RedirectToAction("Index"));
         }
         else
         {
             var model = new PostStateHistoryViewModel();
             model.PostId          = id;
             model.WorkflowStateId = ValueConstant.WORK_STATE_ID_PUBLISH;
             return(PartialView("_Publish", model));
         }
     }
     catch (Exception ex)
     {
         Logger.LogError(ex);
         throw;
     }
 }
コード例 #24
0
        public async Task <ActionResult> Create()
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Insert))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.Survey, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                var model = new SurveyModel();
                model.IsActive             = false;
                model.IsBranding           = false;
                model.IsPublic             = false;
                model.IsSurveyInvite       = false;
                model.SurveyQuestionsModel = new List <SurveyQuestionsModel>();
                foreach (var item in model.SurveyQuestionsModel)
                {
                    item.SurveyAnswersModel = new List <SurveyAnswersModel>();
                }

                return(PartialView("_Create", model));
            }
        }
コード例 #25
0
        public async Task <ActionResult> Edit(string userId, string tabCode)
        {
            if (!await APIProvider.Authorization(_userSession.BearerToken, ARS.Edit))
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.FuntionType.UserProfile, APIConstant.ACTION_UPDATE);
                return(RedirectToAction("Index"));
            }
            else
            {
                // Get list user set into ViewBag
                string   search     = string.Empty;
                UserType type       = EnumUserConstants.UserType.ISDOCTOR;
                string   apiUserUrl = APIProvider.APIGenerator("User", new List <string> {
                    nameof(search), nameof(type)
                }, true, search, type);
                var list = await APIProvider.Authorize_Get <List <UserViewModel> >(_userSession.BearerToken, apiUserUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                if (list == null)
                {
                    ViewBag.User = ApplicationGenerator.GetObject <UserViewModel>();
                }
                else
                {
                    ViewBag.User = list;
                }

                // Get user profile by tabcode and userId
                string apiUrl = "User/GetUserProfileByTabCode?userId=" + userId + "&tabCode=" + tabCode;
                var    model  = await APIProvider.Authorize_Get <UserProfileViewModel>(_userSession.BearerToken, apiUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

                if (model == null)
                {
                    model = new UserProfileViewModel();
                }
                return(View(model));
            }
        }