public ActionResult InsertDataExist(GetBarangSup2_Result br)
        {
            dbStokEntities dbe = new dbStokEntities();

            dbe.CreateDataExist(br.id_barang, br.tanggal_masuk, br.jumlah_barang, br.deskripsi, br.created_masuk, br.id_supplier);
            return(View("InsertDataExist"));
        }
Пример #2
0
        public ActionResult LoginData(GetUsup2_Result objUser)
        {
            if (ModelState.IsValid)
            {
                using (dbStokEntities db = new dbStokEntities())
                {
                    var obj = db.tbUsers.Where(a => a.username.Equals(objUser.username) && a.password.Equals(objUser.password)).FirstOrDefault();
                    if (obj == null)
                    {
                        return(View("ErrorLogin"));
                    }
                    var supobj = db.Suppliers.Where(b => b.id_user.Equals(obj.id_user)).FirstOrDefault();

                    if (obj != null && obj.status_user == 1)
                    {
                        Session["UserID"]   = obj.id_user.ToString();
                        Session["UserName"] = obj.username.ToString();
                        Session["SupID"]    = supobj.id_supplier.ToString();
                        Session["SupName"]  = supobj.nama_supplier.ToString();
                        return(RedirectToAction("SupplierDashBoard"));
                    }
                    else if (obj.status_user == 0)
                    {
                        Session["UserID"]   = obj.id_user.ToString();
                        Session["UserName"] = obj.username.ToString();
                        return(RedirectToAction("AdminDashBoard"));
                    }
                }
            }

            return(View(objUser));
        }
        public ActionResult InsertData(GetBarangSup2_Result br)
        {
            dbStokEntities dbe = new dbStokEntities();

            dbe.CreateData(br.id_kategori, br.id_supplier, br.kode_barang, br.nama_barang, br.id_barang, br.jumlah_barang, br.tanggal_masuk, br.jum_barang_masuk, br.created_masuk, br.deskripsi, br.updated_masuk);
            return(View("InsertData"));
        }