Пример #1
0
        public IActionResult Index(int id)
        {
            HotelRoomProfilePictureViewModel model = new HotelRoomProfilePictureViewModel();

            model.RoomId = id;
            return(PartialView(model));
        }
Пример #2
0
        public IActionResult Index(HotelRoomProfilePictureViewModel model)
        {
            if (ModelState.IsValid)
            {
                var room = _context.hotelRooms.FirstOrDefault(p => p.HotelRoomId == model.RoomId);
                using (var memoryStream = new MemoryStream())
                {
                    model.roomImages.CopyToAsync(memoryStream);
                    room.RoomImage = memoryStream.ToArray();
                }

                _repository.Update(room);

                if (_repository.SaveChange())
                {
                    return(RedirectToAction("Index", new { area = "Manager", controller = "HotelRoomProfile", id = model.RoomId }));
                }
            }
            return(PartialView());
        }