Beispiel #1
0
        public async Task <CMSResponse> Submit(CMSRequest req)
        {
            CMSResponse response = new CMSResponse();

            try
            {
                //List<CmsmasterData> models = await dep.GetAll();
                //List<CmsmasterData> listDataSubmit = PopulateCMSMasterBeforeSubmit(models, req);

                var result = await dep.SubmitCMS(req);

                if (result > 0)
                {
                    response.Message   = "Success";
                    response.IsSuccess = true;
                }
                else
                {
                    response.Message   = "Failed";
                    response.IsSuccess = false;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                response.Message   = "Failed";
                response.IsSuccess = false;
            }
            return(response);
        }
Beispiel #2
0
        public async Task <CMSResponse> GetAllBanner()
        {
            CMSResponse response = new CMSResponse();

            response.List_CMSMaster = await dep.GetAllByCategory("Banner");


            return(response);
        }
 public CMSResponse CMSAPIResponse(CMSRequest objRequest)
 {
     try
     {
         objcmsResponse.CMSDashboardGrid = objclsDashboard.GetCMSData(objRequest.DateTime, objRequest.EndDateTime, objRequest.CMSStatus, objRequest.PartnerID, objRequest.productcode);
         return(objcmsResponse);
     }
     catch (Exception)
     {
         return(objcmsResponse);
     }
     finally
     {
         objcmsResponse  = null;
         objclsDashboard = null;
     }
 }
Beispiel #4
0
        public async Task <CMSResponse> GetAllMaster()
        {
            CMSResponse response = new CMSResponse();


            try
            {
                response.List_CMSMaster = await dep.GetAllCMSMaster();

                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Message   = ex.Message.ToString();
            }
            return(response);
        }
Beispiel #5
0
        public async Task <CMSResponse> SubmitCMSChange([FromBody] CMSRequest model)
        {
            CMSResponse resp = new CMSResponse();

            try
            {
                string bearer   = Request.HttpContext.Request.Headers["Authorization"];
                string token    = bearer.Substring("Bearer ".Length).Trim();
                string username = string.Empty;
                if (string.IsNullOrEmpty(token))
                {
                    resp.IsSuccess = false;
                    resp.Message   = "You don't have access.";
                    return(resp);
                }

                username = sec.ValidateToken(token);
                if (username == null)
                {
                    Response.HttpContext.Response.Cookies.Append("access_token", "", new CookieOptions()
                    {
                        Expires = DateTime.Now.AddDays(-1)
                    });
                    resp.IsSuccess = false;
                    resp.Message   = "Your session was expired, please re-login.";
                    return(resp);
                }
                model.Username = username;

                resp = await facade.Submit(model);


                return(resp);
            }
            catch (Exception)
            {
                return(resp);
            }
        }