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); }
public ActionResult SaveList(CreateListViewModel list) { list.OwnerID = User.Identity.GetUserId(); //save in database listRepository.AdddList(list.ConvertToList()); return(RedirectToAction("Index")); }
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(); }
/// <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)); }
public ActionResult Create(CreateListViewModel viewModel) { if (!ModelState.IsValid) { return(RedirectToAction("MyLists")); } try { ListService.CreateList(viewModel); } catch { throw; } return(RedirectToAction("MyLists")); }
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); }
public ActionResult CreateList(CreateListViewModel model) { SharepointHelper.CreateList(model.Title); return(RedirectToAction("Index")); }