public ActionResult Edit(Tbl_BuyerProfile category)
        {
            dbMyEFarmingProjectEntities db = new dbMyEFarmingProjectEntities();

            try
            {
                if (ModelState.IsValid)
                {
                    string fileName  = Path.GetFileNameWithoutExtension(category.ImageFile.FileName);
                    string extension = Path.GetExtension(category.ImageFile.FileName);
                    fileName        = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                    category.BImage = "~/BImage/" + fileName;
                    fileName        = Path.Combine(Server.MapPath("~/BImage/"), fileName);
                    category.ImageFile.SaveAs(fileName);

                    category.BModifiedDate   = DateTime.Now;
                    category.NidTypeId       = 1;
                    category.DistrictId      = 1;
                    db.Entry(category).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                // TODO: Add update logic here

                return(View(category));
            }
            catch
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Edit(Tbl_SellerProduct category)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string fileName  = Path.GetFileNameWithoutExtension(category.ImgFile.FileName);
                    string extension = Path.GetExtension(category.ImgFile.FileName);
                    fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                    category.SProductImage = "~/ProductImg/" + fileName;
                    fileName = Path.Combine(Server.MapPath("~/ProductImg/"), fileName);
                    category.ImgFile.SaveAs(fileName);

                    category.SModifiedDate = DateTime.Now;
                    //category.BId = (int)(Session["BId"]);
                    category.IsAdminApproved = false;
                    db.Entry(category).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                // TODO: Add update logic here

                return(View(category));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(int id, Tbl_Blog category)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    string fileName  = Path.GetFileNameWithoutExtension(category.BImageFill.FileName);
                    string extension = Path.GetExtension(category.BImageFill.FileName);
                    fileName           = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                    category.BlogImage = "~/BlogImg/" + fileName;
                    fileName           = Path.Combine(Server.MapPath("~/BlogImg/"), fileName);
                    category.BImageFill.SaveAs(fileName);

                    category.BlCreatedDate = DateTime.Now;

                    db.Entry(category).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                // TODO: Add update logic here

                return(View(category));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(Tbl_District category)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(category).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                // TODO: Add update logic here

                return(View(category));
            }
            catch
            {
                return(View());
            }
        }