示例#1
0
        public ActionResult EditShareLink(EditShareLinkRequestDTO dto)
        {
            string      url    = "api/Link/EditShareLink";
            enErrorCode result = _apiAdaptor.Post <EditShareLinkRequestDTO, enErrorCode>(url, dto);

            return(RedirectToAction("BackEndIndex", "ShareLink"));
        }
        public enErrorCode EditShareLink(EditShareLinkRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                ShareLink sl = _dbContext.Set <ShareLink>().Find(dto.LID);
                sl.Category    = dto.Category.ToString();
                sl.Title       = (String.IsNullOrEmpty(dto.Title)) ? String.Empty : dto.Title;
                sl.Description = (String.IsNullOrEmpty(dto.Description)) ? String.Empty : dto.Description;
                sl.ImgUrl      = (String.IsNullOrEmpty(dto.ImgUrl)) ? String.Empty : dto.ImgUrl;
                sl.LinkUrl     = (String.IsNullOrEmpty(dto.LinkUrl)) ? String.Empty : dto.LinkUrl;
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
示例#3
0
        public enErrorCode AddNews(AddNewsRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                News n = new News()
                {
                    Title       = dto.Title.Trim(),
                    Category    = dto.Category.ToString(),
                    NewsContent = dto.NewsContent.Trim(),
                    IsEnable    = true,
                    CreateTime  = DateTime.Now
                };

                var dbSet  = _dbContext.Set <News>().Add(n);
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
        public ActionResult EditNews(EditNewsRequestDTO dto)
        {
            string      url    = "api/News/EditNews";
            enErrorCode result = _apiAdaptor.Post <EditNewsRequestDTO, enErrorCode>(url, dto);

            return(RedirectToAction("BackEndIndex", "News"));
        }
        public enErrorCode AddShareLink(AddShareLinkRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                ShareLink sl = new ShareLink()
                {
                    Category    = dto.Category.ToString(),
                    Title       = (String.IsNullOrEmpty(dto.Title)) ? String.Empty : dto.Title,
                    Description = (String.IsNullOrEmpty(dto.Description)) ? String.Empty : dto.Description,
                    ImgUrl      = (String.IsNullOrEmpty(dto.ImgUrl)) ? "/" : dto.ImgUrl,
                    LinkUrl     = (String.IsNullOrEmpty(dto.LinkUrl)) ? "http://" : dto.LinkUrl
                };

                var dbSet  = _dbContext.Set <ShareLink>().Add(sl);
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
示例#6
0
        public enErrorCode EditCompayInfo(EditCompanyInfoRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                Company c = _dbContext.Set <Company>().Find(dto.CID);
                c.CompanyName  = dto.CompanyName;
                c.Manager      = dto.Manager;
                c.Sales        = dto.Sales;
                c.AboutUs      = dto.AboutUs;
                c.Address      = dto.Address;
                c.Phone        = dto.Phone;
                c.Tax          = dto.Tax;
                c.EMail        = dto.EMail;
                c.MainProducts = dto.MainProducts;
                c.SiteURL      = dto.SiteURL;
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
示例#7
0
        public enErrorCode AddCompayInfo(AddCompanyInfoRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                Company c = new Company()
                {
                    CompanyName  = dto.CompanyName,
                    Manager      = dto.Manager,
                    Sales        = dto.Sales,
                    AboutUs      = dto.AboutUs,
                    Address      = dto.Address,
                    Phone        = dto.Phone,
                    Tax          = dto.Tax,
                    EMail        = dto.EMail,
                    MainProducts = dto.MainProducts,
                    SiteURL      = dto.SiteURL,
                    IsEnable     = true
                };

                var dbSet  = _dbContext.Set <Company>().Add(c);
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
        public ActionResult EditCompanyInfo(EditCompanyInfoRequestDTO dto)
        {
            string      url    = "api/Company/EditCompayInfo";
            enErrorCode result = _apiAdaptor.Post <EditCompanyInfoRequestDTO, enErrorCode>(url, dto);

            return(RedirectToAction("BackEndIndex", "Company"));
        }
        public ActionResult DeleteNews(string NewsId)
        {
            string url = "api/News/DeleteNews";
            DeleteNewsRequestDTO dto = new DeleteNewsRequestDTO()
            {
                NewsID = int.Parse(NewsId)
            };
            enErrorCode result = _apiAdaptor.Post <DeleteNewsRequestDTO, enErrorCode>(url, dto);

            return(RedirectToAction("BackEndIndex", "News"));
        }
示例#10
0
        public enErrorCode DeleteNews(DeleteNewsRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                News n = _dbContext.Set <News>().FirstOrDefault(o => o.ID == dto.NewsID);
                n.IsEnable = false;
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
示例#11
0
        public enErrorCode DeleteCompayInfo(int CID)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                Company n = _dbContext.Set <Company>().Find(CID);
                n.IsEnable = false;
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }
示例#12
0
        public enErrorCode EditNews(EditNewsRequestDTO dto)
        {
            enErrorCode enCode = enErrorCode.EXCEPTION;

            try
            {
                News n = _dbContext.Set <News>().Find(dto.NewsID);
                n.Title       = dto.Title;
                n.Category    = dto.Category.ToString();
                n.NewsContent = dto.NewsContent;
                int result = _dbContext.SaveChanges();

                if (result == 1)
                {
                    enCode = enErrorCode.SUCCESS;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(enCode);
        }