コード例 #1
0
        public ActionResult material_centre_list()
        {
            //try
            //{
            using (ebmsEntities abj = new ebmsEntities())
            {
                List <item_material_centre> ob = (from x in abj.item_material_centre select x).ToList();

                List <materialcentremodel> l = new List <materialcentremodel>();

                foreach (item_material_centre temp in ob)
                {
                    materialcentremodel t = new materialcentremodel();
                    t.material_centre_id      = temp.material_centre_id;
                    t.material_centre_address = temp.material_centre_address;
                    t.material_centre_name    = temp.material_centre_name;
                    t.material_centre_type    = temp.material_centre_type;

                    l.Add(t);
                }

                return(View(l));
            }

            /* }
             * catch(Exception ex)
             * {
             *   Response.Write(ex);
             * }
             *
             * return View();*/
        }
コード例 #2
0
        public ActionResult material_centre(materialcentremodel obj, string Add)
        {
            if (ModelState.IsValid)
            {
                using (ebmsEntities abj = new ebmsEntities())
                {
                    item_material_centre oo = new item_material_centre();

                    oo.material_centre_name    = obj.material_centre_name.ToString();
                    oo.material_centre_type    = obj.material_centre_type.ToString();
                    oo.material_centre_address = obj.material_centre_address.ToString();

                    objcommon.Add_material_centre_detail(oo);

                    ViewBag.status = "Successfully Add";

                    ModelState.Clear();
                }
            }
            return(View());
        }