public async Task <IActionResult> Edit(int id, [Bind("UserID,Email,Password,FirstName,LastName,Phone,IsVerified,ProfileImgPath,LastSeenFavorite,LastSeenMessages")] User user) { if (id != user.UserID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("AssetID,AddressID,Price,EstimatedPrice,Furnished,TypeId,Condition,Size,GardenSize,BalconySize,Rooms,Floor,TotalFloor,NumOfParking,Description,EntryDate,CreatedAt,IsElevator,IsBalcony,IsTerrace,IsStorage,IsRenovated,IsRealtyCommission,IsAircondition,IsMamad,IsPandorDoors,IsAccessible,IsKosherKitchen,IsKosherBoiler,IsOnPillars,IsBars,IsForSell,IsCommercial,IsRoomates,IsImmediate,IsNearTrainStation,IsNearLightTrainStation,IsNearBeach,IsActive,RemovedReason")] Asset asset) { if (id != asset.AssetID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(asset); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssetExists(asset.AssetID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddressID"] = new SelectList(_context.Addresses, "AddressID", "AddressID", asset.AddressID); return(View(asset)); }