Beispiel #1
0
        public void AddDescription(DescriptionModel des)
        {
            Product _product = _repo.GetProduct(des.proid);

            string[] _base64List = FileManager.ExtractBase64Image(des.description);
            string   dir         = "\\webimage\\productimage\\"
                                   + DateTime.Now.Year.ToString()
                                   + "\\" + DateTime.Now.Month.ToString()
                                   + "\\" + DateTime.Now.Day.ToString();


            for (int i = 0; i < _base64List.Length; i++)
            {
                if (FileManager.IsBase64Image(_base64List[i]))
                {
                    string _base64   = FileManager.ExtractBase64(_base64List[i]);
                    string name      = FileManager.GetImageName(_base64List[i + 1]);
                    string imageName = UploadBase64Image(name, _base64);
                    string imageAttr = FileManager.GetImageAttr(_base64List[i + 1]);
                    des.description = FileManager.ReplaceImageSrc(des.description, _base64List[i], dir + "\\" + imageName);
                    des.description = FileManager.ReplaceImageSrc(des.description, imageAttr, ">");
                }
            }
            _product.ProDescription = des.description;
            _repo.SaveChanges();
        }
 public DescriptionController(IDescriptionServices descriptionServices, ICreateDescription createDescription, IReadDescription readDescription, IEditDescription editDescription, IDeleteDescription deleteDescription, DescriptionModel ModelDesc)
 {
     this.ServicesDesc = descriptionServices;
     this.CreateDesc   = createDescription;
     this.ReadDesc     = readDescription;
     this.EditDesc     = editDescription;
     this.DeleteDesc   = deleteDescription;
     this.DescModelc   = ModelDesc;
 }
 public ActionResult Edit(DescriptionModel descModel)
 {
     if (ModelState.IsValid)
     {
         SqlDataReader sqlread = EditDesc.EditDescData(descModel);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View(descModel));
     }
 }
 // GET: Description/Edit/5
 public ActionResult Edit(int id)
 {
     if (ModelState.IsValid)
     {
         DescModelc = ReadDesc.ReadDescData(id);
         return(View(DescModelc));
     }
     else
     {
         return(View(DescModelc));
     }
 }
        public SpecCategoryDescriptionViewModel()
        {
            CategoryViewModel    = new CategoryModel();
            DescriptionViewModel = new DescriptionModel();
            SpecViewModel        = new SpecModel();
            PositionViewModel    = new PositionModel();
            StatusViewModel      = new StatusModel();

            CategoryDescriptionCollection = new List <tblCategoryDescription>();
            DDLSelectIDs = new List <int>();

            dict = new Dictionary <string, List <SelectListItem> >();
        }
        public DescriptionModel GetDescriptionModel(int?DescriptionID)
        {
            DescriptionModel model = new DescriptionModel();

            //UNCOMMENT WHEN DAL SET UP
            //DataTable dtDescription = DAL.GetDescriptionModel(ConnectionString);

            //foreach (DataRow row in dtDescription.Rows)
            //{
            //    model.DescriptionCollection.Add(new DescriptionModel.tblDescription
            //    {
            //        DescriptionID = Convert.ToInt32(row["DescriptionID"]),
            //        DescriptionName = row["DescriptionName"].ToString()
            //    });

            //COMMENT OUT REGION WHEN DAL SET UP
            #region Description Unit test values
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 1, DescriptionName = "Magneto1"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 2, DescriptionName = "Magneto2"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 3, DescriptionName = "Magneto3"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 4, DescriptionName = "Alternator1"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 5, DescriptionName = "Alternator2"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 6, DescriptionName = "Alternator3"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 7, DescriptionName = "Starter1"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 8, DescriptionName = "Starter2"
            });
            model.DescriptionCollection.Add(new DescriptionModel.tblDescription {
                DescriptionID = 9, DescriptionName = "Starter3"
            });
            #endregion

            return(model);
        }
        public ActionResult TagCategoryDescription(Guid?id)
        {
            TagCategory category;

            if (id == null || (category = DbSession.Get <TagCategory>(id.Value)) == null)
            {
                return(HttpNotFound());
            }
            var model = new DescriptionModel();

            model.Body        = category.DescHtml;
            model.Title       = category.Name + " Description";
            model.Keywords    = "";
            model.Description = category.Name;
            PageHeader        = model;
            return(View("Description", model));
        }
 // GET: Description/Delete/5
 public ActionResult Delete(int id)
 {
     DescModelc = ReadDesc.ReadDescData(id);
     return(View(DescModelc));
 }
        public ActionResult Delete(int id, DescriptionModel descModel)//Continue
        {
            SqlDataReader sqlread = DeleteDesc.DeleteDescData(id, descModel);

            return(RedirectToAction("Index", "Home"));
        }