public ActionResult EditManufaceture(Common.Manufacturer manu, string manufaceturename, string dicription, HttpPostedFileBase icon)
        {
            try
            {
                Common.Manufacturer obj = _manufacturersBusiness.GetById(manu.Id);

                obj.ManufacturerName = manufaceturename;
                //     obj.Order = oder;
                obj.Description = dicription;
                if (icon != null && icon.ContentLength > 0)
                {
                    // TourInfo entity=new TourInfo();
                    //Random rdImage = new Random();
                    string randomImage   = Guid.NewGuid().ToString();
                    string fileNameImage = Common.util.Function.ConvertFileName(icon.FileName);
                    string pathImage     = HttpContext.Server.MapPath("~/FileUpload");
                    var    strurlimage   = Common.util.Function.ResizeImageNew(icon, 300, 300, pathImage, randomImage);
                    Common.util.Function.ResizeImageNew(icon, 500, 500, pathImage, randomImage);
                    Common.util.Function.ResizeImageNew(icon, 1000, 1000, pathImage, randomImage);
                    obj.Icon = strurlimage;
                }
                _manufacturersBusiness.Edit(obj);
                return(RedirectToAction("Manufaceture"));
            }
            catch (Exception ex)
            {
                // Write log
                throw;
            }
        }
Esempio n. 2
0
        public JsonResult UpdateManu(Manufacturers obj)
        {
            try
            {
                ManufacturersBusiness manuBusiness = new ManufacturersBusiness();
                var entity = manuBusiness.GetById(obj.ManuId);
                entity.ManufacturerName = obj.ManuName;
                entity.Icon             = obj.icon;
                entity.Description      = obj.Description;
                entity.Order            = obj.Order;

                manuBusiness.Edit(entity);
                return(Json(1));//Cập nhật thành công
            }
            catch (Exception)
            {
                throw;
            }
        }