Example #1
0
        public ActionResult imageupload(HttpPostedFileBase file, MarketShare.Models.admin md)
        {
            if (file != null && file.ContentLength > 0)
            {
                try
                {
                    string filename = "pimg" + md.productid + ".jpg";
                    string path     = Path.Combine(Server.MapPath("~/productimage"),
                                                   Path.GetFileName(filename));
                    file.SaveAs(path);

                    var cm = (from data in db.product_master where data.productid == md.productid select data).FirstOrDefault();
                    cm.productimage = filename;
                    db.SaveChanges();
                    //con.Open();
                    //SqlCommand cmd = new SqlCommand("update  product_master set productimage='" + filename + "' where productid='" + md.productid + "'", con);
                    //cmd.ExecuteNonQuery();
                    //con.Close();


                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    ViewBag.Message = "ERROR:" + ex.Message.ToString();
                }
            }
            else
            {
                ViewBag.Message = "You have not specified a file.";
            }
            return(RedirectToAction("manageproduct", "Admin"));
        }
Example #2
0
        public ActionResult addproduct(MarketShare.Models.admin md)
        {
            int categoryid = 1;
            var a          = (from clist in db.product_category
                              where clist.category == md.category && clist.subcategory == md.subcategory
                              select new
            {
                clist.categoryid
            }).ToList();

            if (a.FirstOrDefault() != null)
            {
                categoryid = a.FirstOrDefault().categoryid;
            }
            try
            {
                DB.product_master obj = new DB.product_master();
                obj.productid    = md.productid;
                obj.categoryid   = categoryid;
                obj.productname  = md.productname;
                obj.mrp          = md.mrp;
                obj.sellingprice = md.sellingprice;
                obj.brand        = md.brand;
                obj.quantity     = md.quantity;
                obj.size         = md.size;
                obj.color        = md.color;
                obj.shortdescp   = md.shortdescp;
                obj.longdescp    = md.longdescp;
                obj.productimage = "noimg.jpg";
                obj.sellerid     = Session["adminid"].ToString();
                obj.updatedate   = DateTime.Now;
                obj.addeddate    = DateTime.Now;
                obj.status       = md.status;
                db.product_master.Add(obj);
                db.SaveChanges();
                return(View());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ViewBag.msg = "Successfully Submitted";
                ModelState.Clear();
            }
        }
Example #3
0
        public ActionResult adminforgotpassword(MarketShare.Models.admin md)
        {
            var u = (from userlist in db.admin_master
                     where userlist.adminid == md.adminid && userlist.emailid == md.emailid

                     select new
            {
                userlist.password
            }).ToList();

            if (u.FirstOrDefault() != null)
            {
                ViewBag.msg = "Your Password is:" + u.FirstOrDefault().password;
            }
            else
            {
                ViewBag.msg = "Invalid input Credentials.";
            }
            return(View());
        }
Example #4
0
        public ActionResult adminlogin(MarketShare.Models.admin md)
        {
            var a = (from userlist in db.admin_master
                     where userlist.adminid == md.adminid && userlist.password == md.password
                     select new
            {
                userlist.adminid,
                userlist.password
            }).ToList();

            if (a.FirstOrDefault() != null)
            {
                Session["adminid"] = a.FirstOrDefault().adminid;
                return(RedirectToAction("adminhome", "Admin"));
            }
            else
            {
                ViewBag.msg = "Invalid login Credentials.";
            }
            return(View());
        }
Example #5
0
 public ActionResult addcategory(MarketShare.Models.admin md)
 {
     try
     {
         DB.product_category obj = new DB.product_category();
         obj.categoryid  = md.categoryid;
         obj.category    = md.category;
         obj.subcategory = md.subcategory;
         obj.type        = md.type;
         db.product_category.Add(obj);
         db.SaveChanges();
         return(View());
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         ViewBag.msg = "Successfully Submitted";
         ModelState.Clear();
     }
 }