public UserModel GetUser(int id) { using (var db = new OceanbnbDbEntities()) { Users_GetById_Result userResult = db.Users_GetById(id).SingleOrDefault(); return(new UserModel(userResult.UserId, userResult.UserName, userResult.Email, userResult.Gender, userResult.City, userResult.Description, userResult.ProfilePhoto, userResult.AspUserId, userResult.IsDeleted)); } }
public UserModel Update(int id, string userName, string email, string gender, string city, string description, string profilePhoto, string aspUserId) { using (var db = new OceanbnbDbEntities()) { db.Users_Update(id, userName, email, gender, city, description, profilePhoto).SingleOrDefault(); Users_GetById_Result userResult = db.Users_GetById(id).SingleOrDefault(); return(new UserModel(userResult.UserId, userResult.UserName, userResult.Email, userResult.Gender, userResult.City, userResult.Description, userResult.ProfilePhoto, userResult.AspUserId, userResult.IsDeleted)); } }