Esempio n. 1
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/ServiceType
        public IHttpActionResult Post(ServiceTypeModel country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.ServiceTypes.Add(new ServiceType()
                {
                    id = country.id,
                    ServiceTypeName = country.ServiceTypeName,
                    Description     = country.Description,
                    InsertedBy      = country.InsertedBy,
                    InsertedOn      = country.InsertedOn,
                    IsActive        = country.IsActive,
                    IsDelete        = country.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 2
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/Country
        public IHttpActionResult Post(GuestModel guest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Guests.Add(new Guest()
                {
                    Id                 = guest.Id,
                    GuestName          = guest.GuestName,
                    GuestContactNumber = guest.GuestContactNumber,
                    GuestAddress       = guest.GuestAddress,
                    IdProof            = guest.IdProof,
                    RoomId             = guest.RoomId,
                    ServiceTypeId      = guest.ServiceTypeId,
                    Description        = guest.Description,
                    InsertedBy         = guest.InsertedBy,
                    InsertedOn         = guest.InsertedOn,
                    IsActive           = guest.IsActive,
                    IsDelete           = guest.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 3
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/Country
        public IHttpActionResult Post(RoomModel country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Rooms.Add(new Room()
                {
                    id           = country.id,
                    RoomNumber   = country.RoomNumber,
                    RoomStatusId = country.RoomStatusId,
                    BedId        = country.BedId,
                    FloorId      = country.FloorId,
                    HotelId      = country.HotelId,
                    RoomTypeId   = country.RoomTypeId,
                    Description  = country.Description,
                    InsertedBy   = country.InsertedBy,
                    InsertedOn   = country.InsertedOn,
                    IsActive     = country.IsActive,
                    IsDelete     = country.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 4
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/City
        public IHttpActionResult Post(CityModel city)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Cities.Add(new City()
                {
                    Id         = city.Id,
                    StateId    = city.StateId,
                    CountryId  = city.CountryId,
                    InsertedBy = city.InsertedBy,
                    InsertedOn = city.InsertedOn,
                    IsActive   = city.IsActive,
                    IsDelete   = city.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 5
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/Status


        public IHttpActionResult Post(StatusModel status)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Status.Add(new Status()
                {
                    id          = status.id,
                    Status1     = status.Status,
                    Description = status.Description,
                    InsertedOn  = status.InsertedOn,
                    InsertedBy  = status.InsertedBy,
                    IsActive    = status.IsActive,
                    IsDelete    = status.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 6
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/Bed


        public IHttpActionResult Post(BedModel country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Beds.Add(new Bed()
                {
                    id          = country.id,
                    Bed_Code    = country.BedCode,
                    Description = country.Description,
                    Bed_Number  = country.Bed_Number,

                    InsertedOn = country.InsertedOn,
                    InsertedBy = country.InsertedBy,
                    IsActive   = country.IsActive,
                    IsDelete   = country.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 7
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/User
        public IHttpActionResult Post(UserModel country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.Users.Add(new User()
                {
                    UserId      = country.Id,
                    UserRole    = country.UserRole,
                    UserName    = country.UserName,
                    Password    = country.Password,
                    Description = country.Description,
                    InsertedBy  = country.InsertedBy,
                    InsertedOn  = country.InsertedOn,
                    IsActive    = country.IsActive,
                    IsDelete    = country.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 8
0
        /// <summary>
        /// Insert a new value in the list
        /// </summary>
        /// <param name=<em>"value"</em>>New value to be inserted</param>
        // POST: api/RoomType


        public IHttpActionResult Post(RoomTypeModel country)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new HTMEntities3())
            {
                ctx.RoomTypes.Add(new RoomType()
                {
                    id           = country.id,
                    RoomName     = country.RoomName,
                    Description  = country.Description,
                    BedId        = country.BedId,
                    RoomStatusId = country.RoomStatusId,
                    Code         = country.Code,
                    Max_Child_No = country.Max_Child_No,
                    Max_Adult_No = country.Max_Adult_No,
                    InsertedOn   = country.InsertedOn,
                    InsertedBy   = country.InsertedBy,
                    IsActive     = country.IsActive,
                    IsDelete     = country.IsDelete
                });

                ctx.SaveChanges();
            }

            return(Ok());
        }
Esempio n. 9
0
 /// <summary>
 /// Public Constructor,initializes privately declared local variables.
 /// </summary>
 /// <param name="context"></param>
 public GenericRepository(HTMEntities3 context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }
Esempio n. 10
0
 public UnitOfWork()
 {
     _context = new HTMEntities3();
 }