예제 #1
0
        public ActionResult EditUser(int User_Id)
        {
            FillViewBag();
            usp_tblUserMasterGetByID_Result userdetails = InventoryEntities.usp_tblUserMasterGetByID(User_Id).FirstOrDefault();

            return(View(userdetails));
        }
예제 #2
0
        public ActionResult CreateUserDetails(FormCollection frm)
        {
            try
            {
                usp_tblUserMasterGetByID_Result userdetails = new usp_tblUserMasterGetByID_Result();
                TryUpdateModel(userdetails);
                USP_GetUserDetails_Result logindetails;
                //if (Session["logindetails"] != null)
                //{
                logindetails = (USP_GetUserDetails_Result)Session["logindetails"];
                // }
                string result = (string)InventoryEntities.usp_tblUserMasterInsertUpdate(0, userdetails.User_Name, userdetails.Address, userdetails.Email,
                                                                                        userdetails.Contact_Number, userdetails.IMIE1, userdetails.IMIE2, userdetails.Login_Id, userdetails.Password, userdetails.Group_Id, logindetails.Company_Id,
                                                                                        DateTime.Now, userdetails.UserStatus, logindetails.USer_Id, userdetails.Branch_Id, 0).FirstOrDefault();

                if (result == "Duplicate user")
                {
                    FillViewBag();
                    ModelState.AddModelError("Error", "User already exists");

                    return(View());
                }

                else
                {
                    return(RedirectToAction("ListUsers"));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("ListUsers"));
            }
        }
예제 #3
0
        public ActionResult EditUser(FormCollection frm)
        {
            usp_tblUserMasterGetByID_Result userdetails = new usp_tblUserMasterGetByID_Result();

            TryUpdateModel(userdetails);
            USP_GetUserDetails_Result logindetails;

            //if (Session["logindetails"] != null)
            //{
            logindetails = (USP_GetUserDetails_Result)Session["logindetails"];
            // }
            string result = (string)InventoryEntities.usp_tblUserMasterInsertUpdate(userdetails.User_Id, userdetails.User_Name, userdetails.Address, userdetails.Email,
                                                                                    userdetails.Contact_Number, userdetails.IMIE1, userdetails.IMIE2, userdetails.Login_Id, userdetails.Password, userdetails.Group_Id, logindetails.Company_Id,
                                                                                    DateTime.Now, userdetails.UserStatus, logindetails.USer_Id, userdetails.Branch_Id, 0).FirstOrDefault();

            return(RedirectToAction("ListUsers"));
        }