public ActionResult Create(t_hotel a, HttpPostedFileBase ImageId)
        {
            if (ModelState.IsValid) {
                if (ImageId != null)
                {
                    ImageId.SaveAs(HttpContext.Server.MapPath("~/Upload/")
                                                          + ImageId.FileName);
                    a.ImgName = ImageId.FileName;
                    //

                }

               ause.AddHotel(a);
                //    var path = Path.Combine(Server.MapPath("~/Upload/"), ImageId.FileName);
                //    ImageId.SaveAs(path);

                return RedirectToAction("Index");
            }
            else
            {
                return View();
               }
        }
Пример #2
0
 public void UpdateHotel(t_hotel a)
 {
     //_repository.Update(entity);
     utwk.HotelRepository.Update(a);
     utwk.Commit();
 }
Пример #3
0
 public void DeleteHotel(t_hotel a)
 {
     utwk.HotelRepository.Delete(a);
     utwk.Commit();
 }
Пример #4
0
 public void AddHotel(t_hotel a)
 {
     utwk.HotelRepository.Add(a);
     utwk.Commit();
 }
 public ActionResult Edit(t_hotel c)
 {
     //if (ModelState.IsValid)
     //{
     try {
         ause.UpdateHotel(c);
         return RedirectToAction("Index");
     }
     catch { return View(); }
     //}
     //else
     //{
     //    return View();
     //}
 }