public IEnumerable <FriendPhotoEntryModel> GetFriends(int userId) { List <FriendPhotoEntryModel> list = new List <FriendPhotoEntryModel>(); SQLConnector.RetrieveMultiple(x => { x.CommandText = "dbo.Select_User_Friends_By_UserId"; x.Parameters.AddWithValue("@UserId", userId); }, (DataTable dt) => { if (dt != null) { foreach (DataRow dr in dt.Rows) { FriendPhotoEntryModel model = new FriendPhotoEntryModel { FriendId = dr.Field <int>("Id"), FriendName = dr.Field <String>("FriendName"), ImageBase64 = dr.Field <String>("FriendBase64Image"), UserId = dr.Field <int>("UserId"), ImageExtension = dr.Field <string>("Extension") }; list.Add(model); } } }); return(list); }
public IActionResult AddFriend(FriendPhotoEntryModel model) { if (ModelState.IsValid) { this.UserRepository.AddFriend(model); } return(View(model)); }
public void AddFriend(FriendPhotoEntryModel model) { SQLConnector.UpdateOne(x => { x.CommandText = "dbo.Insert_New_Friend"; x.Parameters.AddWithValue("@FriendName", model.FriendName); x.Parameters.AddWithValue("@Base64", model.ImageBase64); x.Parameters.AddWithValue("@UserId", model.UserId); x.Parameters.AddWithValue("@Extension", model.ImageExtension); }); }