public bool UpdateElement(Ads_Object objAds) { mdbContext.WEB_CARONLINE_SP_Ads_Update(objAds.AdsID, objAds.Icon, objAds.Tittle, objAds.Image, objAds.Rank, objAds.Content, objAds.Position, objAds.Status, objAds.IsDeleted, objAds.Link, objAds.ImageFlag); return(true); }
public ActionResult Ads_Update(Ads_Object objAds) { /*HttpPostedFileBase file = Request.Files[0]; * if (file.ContentLength > 0 && file.ContentType.Contains("image")) * { * var fileName = DateTime.Now.ToString("ddMMyyyyhhMMss") + "-" + Path.GetFileName(file.FileName); * var path = Path.Combine(Server.MapPath("~/Content/Galleries/Ads"), fileName); * file.SaveAs(path); * objAds.Image = fileName; * } * new Ads_BCL().ExecuteOf_UpdateElement(objAds); * return RedirectToAction("Manage_Ads", "Ads");*/ objAds.ImageFlag = false; if (Request.Form["localfile"] != null) { objAds.ImageFlag = true; HttpPostedFileBase file = Request.Files["Avatar"]; if (file.ContentLength > 0 && file.ContentType.Contains("image")) { var fileName = DateTime.Now.ToString("ddMMyyyyhhMMss") + "-" + Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/Content/Galleries/Ads"), fileName); file.SaveAs(path); objAds.Image = fileName; } } else { var imagelink = Request.Form["Image"]; objAds.Image = imagelink; } new Ads_BCL().ExecuteOf_UpdateElement(objAds); return(RedirectToAction("Manage_Ads", "Ads")); }
public ActionResult Ads_Insert(Ads_Object AdsObject) { /* AdsObject.AdsID = Guid.NewGuid(); * HttpPostedFileBase file = Request.Files[0]; * if (file.ContentLength > 0 && file.ContentType.Contains("image")) * { * var fileName = DateTime.Now.ToString("ddMMyyyyhhMMss") + "-" + Path.GetFileName(file.FileName); * var path = Path.Combine(Server.MapPath("~/Content/Galleries/Ads"), fileName); * file.SaveAs(path); * AdsObject.Image = fileName; * } * AdsObject.IsDeleted = false; * AdsObject.ImageFlag = false; * new Ads_BCL().ExecuteOf_InSertElement(AdsObject); * return RedirectToAction("Manage_Ads", "Ads");*/ AdsObject.AdsID = Guid.NewGuid(); AdsObject.IsDeleted = false; AdsObject.ImageFlag = false; if (Request.Form["localfile"] != null) { AdsObject.ImageFlag = true; HttpPostedFileBase file = Request.Files["Avatar"]; if (file.ContentLength > 0 && file.ContentType.Contains("image")) { var fileName = DateTime.Now.ToString("ddMMyyyyhhMMss") + "-" + Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/Content/Galleries/Ads"), fileName); file.SaveAs(path); AdsObject.Image = fileName; } } new Ads_BCL().ExecuteOf_InSertElement(AdsObject); return(RedirectToAction("Manage_Ads", "Ads")); }
public Ads_Object GetElementById(Guid AdsId) { var objData = mdbContext.WEB_CARONLINE_SP_Ads_GetByID(AdsId); List <Ads_Object> lisAdsObject = new List <Ads_Object>(); foreach (var obj in objData) { Ads_Object objAds = new Ads_Object(); objAds.AdsID = obj.AdsID; objAds.Icon = obj.Icon; objAds.Tittle = obj.Tittle; objAds.Image = obj.Image; objAds.Rank = obj.Rank; objAds.Content = obj.Content; objAds.Position = obj.Position; objAds.Status = obj.Status; objAds.IsDeleted = obj.IsDeleted; objAds.Link = obj.Link; objAds.ImageFlag = (bool)obj.ImageFlag; return(objAds); } return(null); }
public bool ExecuteOf_UpdateElement(Ads_Object objAds) { return(mAdsDao.UpdateElement(objAds)); }
public bool ExecuteOf_InSertElement(Ads_Object objAds) { return(mAdsDao.InSertElement(objAds)); }