public ActionResult Create(FormCollection formCollection)
        {
            ViewData["Action"] = "Create";
            var user = new USER();
            try
            {
                if (ModelState.IsValid)
                {
                    using (var dc = new db_ultramedicaDataContext(Helper.ConnectionString()))
                    {
                        user.NIK = formCollection["NIK"];
                        user.NAMA = formCollection["NAMA"];
                        user.POSISI = formCollection["POSISI"];
                        user.USERNAME = formCollection["USERNAME"];
                        if (!string.IsNullOrEmpty(formCollection["PASSWORD"])) user.PASSWORD = formCollection["PASSWORD"];
                        user.ROLES = formCollection["ROLES"];

                        dc.USERs.InsertOnSubmit(user);
                        dc.SubmitChanges();
                    }
                    // TODO: Add insert logic here
                    return RedirectToAction("Index");
                }
                return View();
            }
            catch (Exception ex)
            {
                ViewData["ErrorMessage"] = ex.Message;
                return View(user);
            }
        }
 partial void DeleteUSER(USER instance);
 partial void UpdateUSER(USER instance);
 partial void InsertUSER(USER instance);
        public ActionResult LogOn(USER model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                using (var data = new db_ultramedicaDataContext(Helper.ConnectionString()))
                {
                    bool isFound = false;

                    foreach (USER employee in data.USERs)
                    {
                        if (employee.USERNAME == model.USERNAME && employee.PASSWORD == model.PASSWORD)
                        {
                            isFound = true;
                            FormsAuthentication.SetAuthCookie(model.USERNAME, false);
                            {
                                Session["user"] = employee;
                                Session["roles"] = employee.ROLES;
                                return RedirectToAction("Index", "Employee");
                            }
                        }
                    }

                    if (!isFound)
                    {
                        ModelState.AddModelError("", "The user name or password provided is incorrect.");
                    }
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult Edit(FormCollection formCollection)
        {
            ViewData["Action"] = "Edit";
            var userdb = new USER();
            using (var dc = new db_ultramedicaDataContext(Helper.ConnectionString()))
            {
                userdb = dc.USERs.SingleOrDefault(o => o.NIK.Equals(formCollection["NIK"]));
                try
                {
                    if (userdb != null)
                    {
                        if (ModelState.IsValid)
                        {

                            userdb.NAMA = formCollection["NAMA"];
                            userdb.POSISI = formCollection["POSISI"];
                            userdb.USERNAME = formCollection["USERNAME"];
                            if (!string.IsNullOrEmpty(formCollection["PASSWORD"])) userdb.PASSWORD = formCollection["PASSWORD"];
                            userdb.ROLES = formCollection["ROLES"];
                            dc.SubmitChanges();
                        }
                    }

                    return RedirectToAction("Index");
                }
                catch (Exception ex)
                {
                    ViewData["ErrorMessage"] = ex.Message;
                    return View(userdb);
                }
            }
        }
        public ActionResult Edit(string userNik)
        {
            if (Session["user"] != null)
            {
                InitializeSession();
                ViewData["Action"] = "Edit";
                USER user = new USER();
                try
                {
                    ViewData["ErrorMessage"] = "";

                    // TODO: Add insert logic here
                    using (var dc = new db_ultramedicaDataContext(Helper.ConnectionString()))
                    {
                        user = dc.USERs.SingleOrDefault(o => o.NIK.Equals(userNik));
                    }
                    return View(user);
                }
                catch (Exception ex)
                {
                    ViewData["ErrorMessage"] = ex.Message;
                    return View(user);
                }
            }
            return RedirectToAction("LogOut", "Account");
        }