public void addAdvertisement(AdsModels ads) { Advertisement an = new Advertisement(); an.posted = DateTime.Now; an.isdisplayed = true; an.title = ads.adtitle; an.txt = ads.adtxt; an.url = ads.adimgurl; db.Advertisements.InsertOnSubmit(an); db.SubmitChanges(); }
public ActionResult AdAdd(AdsModels a) { var destinationFolder = Server.MapPath("/Content/Images/"); foreach (string name in Request.Files) { HttpPostedFileBase hpf = Request.Files[name] as HttpPostedFileBase; var postedFile = Request.Files[name]; if (postedFile.ContentLength > 0) { var fileName = System.IO.Path.GetFileName(postedFile.FileName); fileName = "current.png"; //Done because there was no time to implement sending the actual filename to //the partial view sidebar var path = System.IO.Path.Combine(destinationFolder, fileName); postedFile.SaveAs(path); a.adimgurl = "/Content/Images/" + fileName.ToString(); } } monster.addAdvertisement(a); return View(a); }
public void addAdvertisement(AdsModels ads) { }