Esempio n. 1
0
        public JsonResult Add(ReignsViewModels model)
        {
            var rol = new Reign();

            rol.Name = model.Name;
            db.Reigns.Add(rol);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult Add(RoleViewModels model)
        {
            var rol = new UserRole();

            rol.RoleName = model.RoleName;
            rol.IsActive = model.IsActive;
            db.UserRoles.Add(rol);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Add(RoleMenuMappingViewModels model)
        {
            var rmm = new RoleMenuMapping();

            rmm.RoleId   = model.RoleId;
            rmm.MenuId   = model.MenuId;
            rmm.IsActive = true;
            db.RoleMenuMappings.Add(rmm);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Add(MenuMasterViewModels model)
        {
            var mmast = new MenuMaster();

            mmast.MenuName     = model.MenuName;
            mmast.MenuUrl      = model.MenuUrl;
            mmast.MenuParentId = model.MenuParentId;
            mmast.IsActive     = true;
            db.MenuMasters.Add(mmast);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public ActionResult EmpCreate(EmployeeFinal empFinal)
        {
            EMPLOYEE employee = new EMPLOYEE();

            // Retrieve form data using form collection
            employee.NAME   = empFinal.eMPLOYEE.NAME;
            employee.CITY   = empFinal.eMPLOYEE.CITY;
            employee.AGE    = empFinal.eMPLOYEE.AGE;
            employee.DEPTID = empFinal.eMPLOYEE.DEPTID;
            db.EMPLOYEEs.Add(employee);
            db.SaveChanges();


            return(RedirectToAction("EmpList"));
        }
Esempio n. 6
0
        //新增資料方法
        public void InsertGuestbooks(Guestbooks newData)
        {
            newData.Id = Guid.NewGuid();

            newData.CreateTime = DateTime.Now;

            db.Guestbooks.Add(newData);

            db.SaveChanges();
            //try {
            //    db.SaveChanges();
            //}
            //catch(Exception)
            //{
            //    throw;
            //}
        }
Esempio n. 7
0
        public ActionResult AddOrder(tbl_order order)
        {
            order.productName = Request.Form["txtname"].ToString();
            order.price       = int.Parse(Request.Form["txtprice"].ToString());
            //string name= Request.Form["ddlCustomer"].ToString();
            //var n = db.tbl_customer.Where(x => x.customerName == name) ;


            order.customerId = int.Parse(Request.Form["ddlCustomer"].ToString());

            db.tbl_order.Add(order);
            var result = db.SaveChanges();

            if (result > 0)
            {
                ModelState.AddModelError("", "Data Inserted");
            }
            return(View());
        }
Esempio n. 8
0
        public JsonResult Add(UserManagementViewModels model)
        {
            var uman = new UserManagement();

            uman.UserName     = model.UserName;
            uman.UserPassword = model.UserPassword;
            uman.UserEmail    = model.UserEmail;
            uman.UserRoleId   = model.UserRoleId;
            uman.UserReignsId = model.UserReignsId;
            uman.IsActive     = true;
            uman.IsDelete     = false;
            uman.CBY          = @User.Identity.Name;
            uman.CDate        = DateTime.Now;
            uman.MBY          = @User.Identity.Name;
            uman.MDate        = DateTime.Now;
            db.UserManagements.Add(uman);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
 //註冊新會員方法
 public void Register(Members newMember)
 {
     newMember.Password = HashPassword(newMember.Password);
     db.Members.Add(newMember);
     db.SaveChanges();
 }