Ejemplo n.º 1
0
        public int UpdateOrInsertHotelService(tbl_HotelService obj)
        {
            using (var db = _connectionData.OpenDbConnection())
            {
                if (obj.Id > 0)
                {
                    var query     = db.From <tbl_HotelService>().Where(e => e.Id == obj.Id);
                    var objUpdate = db.Select(query).SingleOrDefault();
                    if (objUpdate != null)
                    {
                        //bjUpdate.Code = obj.Code;
                        objUpdate.Name        = obj.Name;
                        objUpdate.Status      = obj.Status;
                        objUpdate.Description = obj.Description;
                        objUpdate.CreateDate  = DateTime.Now;
                        objUpdate.Createby    = comm.GetUserId();

                        return(db.Update(objUpdate));
                    }
                    return(-1);
                }
                else
                {
                    obj.SysHotelID = comm.GetHotelId();
                    return((int)db.Insert(obj, selectIdentity: true));
                }
            }
        }
        public PartialViewResult Edit(string id)
        {
            tbl_HotelService obj = (new HotelSvrService()).GetHotelServiceByID(id);

            if (obj == null)
            {
                obj = (new HotelSvrService()).InitEmpty();
            }
            return(PartialView("EditHotelService", obj));
        }
Ejemplo n.º 3
0
        public tbl_HotelService InitEmpty()
        {
            var obj = new tbl_HotelService();

            obj.Id          = 0;
            obj.Name        = "";
            obj.Description = "";
            obj.Status      = 1;
            return(obj);
        }
        public ActionResult Update(tbl_HotelService obj)
        {
            int result = new HotelSvrService().UpdateOrInsertHotelService(obj);

            return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
        }