public static bool UpdateSocialNetProfile(SocialNetworkProfile socialNetworkProfile) { try { using (couponEntities2 ce = new couponEntities2()) { var result = ce.SocialNetworkProfiles.SingleOrDefault(b => b.Id == socialNetworkProfile.Id); if (result != null) { result.User_Id = socialNetworkProfile.User_Id; result.User = socialNetworkProfile.User; result.authToken = socialNetworkProfile.authToken; result.password = socialNetworkProfile.password; result.recivedData = socialNetworkProfile.recivedData; result.sendData = socialNetworkProfile.sendData; result.username = socialNetworkProfile.username; ce.SaveChanges(); } } } catch (Exception) { return(false); } return(true); }
public static int CreateSocialNet(string username, string password, string sendData, string recivedData, string authToken, int id) { try { using (couponEntities2 ce = new couponEntities2()) { SocialNetworkProfile socialNetwork = new SocialNetworkProfile { username = username, password = password, sendData = sendData, recivedData = recivedData, authToken = authToken, User_Id = id }; ce.SocialNetworkProfiles.Add(socialNetwork); ce.SaveChanges(); return(socialNetwork.Id); } } catch (Exception) { return(-1); } }