예제 #1
0
        public ActionResult AddShareLink(AddShareLinkRequestDTO dto)
        {
            string url = "api/Link/AddShareLink";
            enErrorCode result = _apiAdaptor.Post<AddShareLinkRequestDTO, enErrorCode>(url, dto);

            return RedirectToAction("BackEndIndex", "ShareLink");
        }
예제 #2
0
        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;
        }