public ActionResult Edit([Bind(Include = "adNo,shNo,empNo,adTitle,adApplyDate,adStartDate,adTime,adPrice,adPic,adURL,adCheckState")] ADVERTISEMENT aDVERTISEMENT)
 {
     if (ModelState.IsValid)
     {
         Service.Update(aDVERTISEMENT);
         return(RedirectToAction("Index"));
     }
     ViewBag.empNo = new SelectList(EmpService.Get(), "empno", "empname", aDVERTISEMENT.empNo);
     ViewBag.shNo  = new SelectList(ShopService.Get(), "shno", "shthepic", aDVERTISEMENT.shNo);
     return(View(aDVERTISEMENT));
 }
        // GET: Admin/Advertise/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ADVERTISEMENT aDVERTISEMENT = Service.FindOne(id);

            if (aDVERTISEMENT == null)
            {
                return(HttpNotFound());
            }
            return(View(aDVERTISEMENT));
        }
        // GET: Admin/Advertise/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ADVERTISEMENT aDVERTISEMENT = Service.FindOne(id);

            if (aDVERTISEMENT == null)
            {
                return(HttpNotFound());
            }
            ViewBag.empNo = new SelectList(EmpService.Get(), "empno", "empname", aDVERTISEMENT.empNo);
            ViewBag.shNo  = new SelectList(ShopService.Get(), "shno", "shthepic", aDVERTISEMENT.shNo);
            return(View(aDVERTISEMENT));
        }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="emp"></param>
 /// <returns></returns>
 public int Update(ADVERTISEMENT obj)
 {
     try
     {
         using (AllShowEntities db = new AllShowEntities())
         {
             db.Entry(obj).State = EntityState.Modified;
             return(db.SaveChanges());
         }
     }
     catch (DbEntityValidationException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="emp"></param>
 /// <returns></returns>
 public int Create(ADVERTISEMENT obj)
 {
     try
     {
         using (AllShowEntities db = new AllShowEntities())
         {
             db.ADVERTISEMENT.Add(obj);
             return(db.SaveChanges());
         }
     }
     catch (DbEntityValidationException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="emp"></param>
 /// <returns></returns>
 public int Delete(int id)
 {
     try
     {
         using (AllShowEntities db = new AllShowEntities())
         {
             ADVERTISEMENT target = db.ADVERTISEMENT.Where(m => m.adNo == id).FirstOrDefault();
             db.ADVERTISEMENT.Remove(target);
             return(db.SaveChanges());
         }
     }
     catch (DbEntityValidationException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #7
0
 public Advertisement(ADVERTISEMENT entity = null)
 {
     if (entity == null)
     {
         return;
     }
     Id             = entity.ID;
     IsActive       = entity.IS_ACTIVE;
     ExpirationDate = entity.EXPIRATION_DATE;
     CreatedDate    = entity.CREATED_DATE;
     Vehicl         = new Vehicl(entity.VEHICL);
     Region         = new Region(entity.REGION);
     ImagePath      = entity.IMAGE_PATH;
     Currency       = new Currency(entity.CURRENCY);
     Price          = entity.PRICE;
     User           = new CarsSaleUser
     {
         Email       = entity.User?.Email,
         UserName    = entity.User?.UserName,
         PhoneNumber = entity.User?.PhoneNumber,
         FullName    = entity.User?.FullName
     };
 }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="emp"></param>
 /// <returns></returns>
 public int Update(ADVERTISEMENT obj)
 {
     return(dao.Update(obj));
 }
Пример #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="emp"></param>
 /// <returns></returns>
 public int Create(ADVERTISEMENT obj)
 {
     return(dao.Create(obj));
 }