Exemplo n.º 1
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new Material();
            this.TryUpdateModel<Material>(model);

            this.BasisDataService.SaveMaterial(model);

            return this.RefreshParent();
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            var classlList = this.BasisDataService.GetClassificationList(new ClassificationRequest());
            //this.ViewBag.Tags = this.CmsService.GetTagList(new TagRequest() { Top = 20, Orderby = Orderby.Hits });

            var model = new Material();
            ViewData.Add("ClassificationID", new SelectList(classlList, "ID", "Name", model.ClassificationID));
            var stu = new { Name = "一次性材料", IsAvailability =false };
            var list = Enumerable.Repeat(stu, 1).ToList();
            list.Add(new { Name = "可复用材料", IsAvailability = true });
            ViewData.Add("IsAvailability", new SelectList(list,"IsAvailability","Name"));
            return View("Edit", model);
        }
Exemplo n.º 3
0
 public void SaveMaterial(Material material)
 {
     using (var dbContext = new BasisDataDbContext())
     {
         if (material.ID > 0)
         {
             dbContext.Update<Material>(material);
         }
         else
         {
             dbContext.Insert<Material>(material);
         }
     }
 }