Beispiel #1
0
        // GET: Home
        public ActionResult Index()
        {
            var db   = new angularEntities();
            var data = db.sp_getlogin();

            return(View(data.ToList()));
        }
Beispiel #2
0
        // GET: Home/Delete/5
        public ActionResult Delete(int id)
        {
            var          db     = new angularEntities();
            SqlParameter param1 = new SqlParameter("@id", id);
            var          data   = db.Database.SqlQuery <login>("exec sp_getloginbyid @id", param1).SingleOrDefault();

            return(View(data));
        }
Beispiel #3
0
        public ActionResult Edit(int?id, login obj)
        {
            var          db     = new angularEntities();
            SqlParameter param1 = new SqlParameter("@username", obj.username);
            SqlParameter param2 = new SqlParameter("@password", obj.password);
            SqlParameter param3 = new SqlParameter("@id", id);
            var          data   = db.Database.ExecuteSqlCommand("sp_loginupdate @id, @username, @password", param3, param1, param2);

            //  db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here


                var          db    = new angularEntities();
                SqlParameter param = new SqlParameter("@id", id);
                db.Database.ExecuteSqlCommand("sp_deletelogin @id", param);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #5
0
        public ActionResult Create(login obj)
        {
            try
            {
                // TODO: Add insert logic here

                var db = new angularEntities();

                SqlParameter param1 = new SqlParameter("@username", obj.username);
                SqlParameter param2 = new SqlParameter("@password", obj.password);
                var          data   = db.Database.ExecuteSqlCommand("sp_logininsert @username , @password", param1, param2);



                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }