예제 #1
0
 public ActionResult Create(Manufacturer_CreateViewmodel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (string.IsNullOrEmpty(model.name))
             {
                 model.name = "";
             }
             if (string.IsNullOrEmpty(model.image))
             {
                 model.image = "no_image.png";
             }
             db.oc_manufacturer.Add(new oc_manufacturer()
             {
                 image      = model.image,
                 name       = model.name,
                 sort_order = model.sort_order,
                 status     = 1,
             });
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
예제 #2
0
        // GET: Manufacturer/Create
        public ActionResult Create()
        {
            var model = new Manufacturer_CreateViewmodel()
            {
                image      = "no_image.png",
                sort_order = 0,
                name       = ""
            };

            return(View(model));
        }