Пример #1
0
        public ActionResult CropTypeUpdate(FormCollection collection)
        {
            CropType c = new CropType();

            c.CropTypeID = Convert.ToInt32(collection["CropTypeID"]);
            c.SelectByID();
            c.Name = collection["Name"];
            if (Request.Files["Photo"].ContentLength > 0)
            {
                string path = "/croptypeimgs/" + DateTime.Now.Ticks.ToString() + "_" + Request.Files["Photo"].FileName;
                Request.Files["Photo"].SaveAs(Server.MapPath(path));
                c.Photo = path;
            }

            c.update();

            return(RedirectToAction("CropTypeList"));
        }