Esempio n. 1
0
        public void Add(RoomTypeViewModel model)
        {
            var entity = new HMS_RoomType
            {
                RoomTypeName = model.RoomTypeName,
                Occupancy    = model.Occupancy,
                Active       = true
            };

            _genericRepository.Add(entity);
        }
Esempio n. 2
0
        public void Edit(RoomTypeViewModel model)
        {
            var entity = new HMS_RoomType
            {
                RoomTypeName = model.RoomTypeName,
                Occupancy    = model.Occupancy,
                Active       = model.Active,
                Id           = model.Id
            };

            _genericRepository.Edit(entity);
        }
Esempio n. 3
0
        public bool CheckDuplicate(HMS_RoomType model)
        {
            PMSEntities         dbContext = new PMSEntities();
            List <HMS_RoomType> checkUnique;

            if (model.Id > 0)
            {
                checkUnique = (from d in dbContext.HMS_RoomType where (d.RoomTypeName == model.RoomTypeName) && (d.Id != model.Id) select d).ToList();
            }
            else
            {
                checkUnique = (from d in dbContext.HMS_RoomType where d.RoomTypeName == model.RoomTypeName select d).ToList();
            }
            return(checkUnique.Count > 0 ? true : false);
        }