public ActionResult Edit(int id)
        {
            var temp = _context.NewApartments.FirstOrDefault(t => t.Id == id);
            NewApartamentsEditViewModel model = new NewApartamentsEditViewModel()
            {
                Picture    = temp.Picture,
                Price      = temp.Price,
                Square     = temp.Square,
                CountRooms = temp.CountRooms,
                Id         = temp.Id,
                IdBuilding = temp.IdBuilding
            };

            return(View(model));
        }
        public ActionResult Edit(NewApartamentsEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var temp = _context.NewApartments.FirstOrDefault(t => t.Id == model.Id);


                temp.Picture    = model.Picture;
                temp.Price      = model.Price;;
                temp.Square     = model.Square;
                temp.CountRooms = model.CountRooms;
                _context.SaveChanges();

                return(RedirectToAction("Index", "NewApartments"));
            }
            return(View(model));
        }