Пример #1
0
        public CreateListViewModel CreateEditList(Product getproduct)
        {
            var viewmodel = new CreateListViewModel();

            viewmodel.ProductId          = getproduct.ProductId;
            viewmodel.Author             = getproduct.Author;
            viewmodel.CategoryId         = getproduct.CategoryId;
            viewmodel.Intro              = getproduct.Intro;
            viewmodel.Name               = getproduct.Name;
            viewmodel.Price              = getproduct.Price;
            viewmodel.UnitInStock        = getproduct.UnitInStock;
            viewmodel.Specification      = getproduct.Specification;
            viewmodel.PublishedDate      = getproduct.PublishedDate;
            viewmodel.Publisher          = getproduct.Publisher;
            viewmodel.ProductImgId       = viewmodel.ProductImgId;
            viewmodel.ISBN               = getproduct.ISBN;
            viewmodel.Description        = getproduct.Description;
            viewmodel.Language           = getproduct.Language;
            viewmodel.Tags               = GetTags();
            viewmodel.CategoryViewModels = GetCatecory();

            var tagLists = GetSelectedTags(getproduct);

            viewmodel.SelectedTags = tagLists;


            return(viewmodel);
        }
Пример #2
0
        public ActionResult SaveList(CreateListViewModel list)
        {
            list.OwnerID = User.Identity.GetUserId();
            //save in database
            listRepository.AdddList(list.ConvertToList());

            return(RedirectToAction("Index"));
        }
Пример #3
0
 public void CreateList(CreateListViewModel list)
 {
     FilmHausDbContext.Lists.Add(new List
     {
         ListId      = Guid.NewGuid(),
         Id          = list.Id,
         CreatedOn   = DateTime.Now,
         Title       = list.Title,
         Description = list.Description,
         Shared      = list.Shared
     });
     FilmHausDbContext.SaveChanges();
 }
Пример #4
0
        /// <summary>
        /// 建立產品資料 包含分類 標籤
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            var service = new ProductService();

            var viewModels = new CreateListViewModel()
            {
                Tags = service.GetTags(),
                CategoryViewModels = service.GetCatecory(),
            };

            if (!ModelState.IsValid)
            {
                return(View(viewModels));
            }

            return(View(viewModels));
        }
Пример #5
0
        public ActionResult Create(CreateListViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("MyLists"));
            }

            try
            {
                ListService.CreateList(viewModel);
            }
            catch
            {
                throw;
            }

            return(RedirectToAction("MyLists"));
        }
Пример #6
0
        public static List ConvertToList(this CreateListViewModel ViewModel)
        {
            List result = new List
            {
                Description  = ViewModel.Description,
                ItemTypeName = ViewModel.ItemTypeName,
                Name         = ViewModel.Name,
                IsPrivate    = ViewModel.IsPrivate,
                Items        = ViewModel.Items.ConvertToListItems()
            };

            if (!string.IsNullOrEmpty(ViewModel.OwnerID))
            {
                result.OwnerID = ViewModel.OwnerID;
            }

            return(result);
        }
Пример #7
0
 public ActionResult CreateList(CreateListViewModel model)
 {
     SharepointHelper.CreateList(model.Title);
     return(RedirectToAction("Index"));
 }