public ActionResult PopupHotelRoomType(HotelRoomTypes model) { var viewModel = new HotelRoomTypes { //formActionName = "PopupHotelRoomType", //formControllerName = "HotelInfo", //formOnSubmitAction = "return SaveConfirm(this,\'C\')", //formSubmitBttnName = "Save" }; if (!ModelState.IsValid) { return(View(viewModel)); } else { //Htl_HotelRoomTypes obj = new Htl_HotelRoomTypes(); //obj.TypeName = model.TypeName; //obj.Details = model.Details; //obj.RoomCapacity = model.RoomCapacity; //obj.isActive = model.isActive; //obj.isDeleted = false; //obj.CreatedBy = App_Class.AppSession.LogUserID; //obj.CreatedDate = DateTime.Now; _RoomTypeRepo.HotelRoomTypeAdd(model); ViewData["success"] = "Record successfully added."; return(RedirectToAction("Create")); } }
public ActionResult Edit(HotelRoomTypes model, int id) { if (!ModelState.IsValid) { return(View()); } else { model.HotelRoomTypeId = id; _RoomTypeRepo.HotelRoomTypeEdit(model); //Htl_HotelRoomTypes obj = new Htl_HotelRoomTypes(); //obj.HotelRoomTypeId = id; //obj.TypeName = model.TypeName; //obj.Details = model.Details; //obj.RoomCapacity = model.RoomCapacity; //obj.isActive = model.isActive; //obj.UpdatedBy = App_Class.AppSession.LogUserID; //obj.UpdatedDate = DateTime.Now; //_RoomTypeRepo.HotelRoomTypeEdit(obj); // ViewData["success"] = "Record edited successfully ."; return(RedirectToAction("List")); } }
public ActionResult PopupHotelRoomType() { var viewModel = new HotelRoomTypes { //formActionName = "PopupHotelRoomType", //formControllerName = "HotelInfo", //formOnSubmitAction = "return SaveConfirm(this,\'C\')", //formSubmitBttnName = "Save" }; return(View(viewModel)); }
public void HotelRoomTypeEdit(HotelRoomTypes model) { Htl_HotelRoomTypes result = ent.Htl_HotelRoomTypes.Where(x => x.HotelRoomTypeId == model.HotelRoomTypeId).FirstOrDefault(); result.HotelRoomTypeId = model.HotelRoomTypeId; result.TypeName = model.TypeName; result.Details = model.Details; result.RoomCapacity = model.RoomCapacity; result.isActive = model.isActive; result.UpdatedBy = App_Class.AppSession.LogUserID; result.UpdatedDate = DateTime.Now; ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result); ent.SaveChanges(); }
// public void HotelRoomTypeAdd(HotelRoomTypes model) { Htl_HotelRoomTypes obj = new Htl_HotelRoomTypes { TypeName = model.TypeName, Details = model.Details, RoomCapacity = model.RoomCapacity, isActive = model.isActive, CreatedBy = App_Class.AppSession.LogUserID, CreatedDate = DateTime.Now, }; ent.AddToHtl_HotelRoomTypes(obj); ent.SaveChanges(); }
//For List view public IEnumerable <HotelRoomTypes> HotelRoomTypeList() { List <HotelRoomTypes> model = new List <HotelRoomTypes>(); var res = ent.Htl_HotelRoomTypes; foreach (var x in res) { HotelRoomTypes obj = new HotelRoomTypes { HotelRoomTypeId = x.HotelRoomTypeId, TypeName = x.TypeName, Details = x.Details, RoomCapacity = x.RoomCapacity, isActive = x.isActive, }; model.Add(obj); } return(model.AsEnumerable()); }
public ActionResult Create(HotelRoomTypes model) { if (!ModelState.IsValid) { return(View()); } else { _RoomTypeRepo.HotelRoomTypeAdd(model); //Htl_HotelRoomTypes obj = new Htl_HotelRoomTypes(); //obj.TypeName = model.TypeName; //obj.Details = model.Details; //obj.RoomCapacity = model.RoomCapacity; //obj.isActive = model.isActive; //obj.CreatedBy = App_Class.AppSession.LogUserID; //obj.CreatedDate = DateTime.Now; //ViewData["success"] = "Record successfully added."; return(RedirectToAction("List")); } }