public string AuthenticateFacebookeUser(string fbAccessToken, string ownerName, string emailAddress) { var ownerExists = context.Owners.Where(o => o.EmailAddress == fbAccessToken).FirstOrDefault(); if (ownerExists != null) { ownerExists.FBAccessToken = fbAccessToken; context.SubmitChanges(); return ownerExists.OwnerId; } else { var guid = Guid.NewGuid().ToString(); var ownerId = guid.Substring(guid.Length - 8); var owner = new Owner { OwnerId = ownerId, OwnerName = ownerName, EmailAddress = emailAddress, TeamName = ownerName, IsCommish = false, IsActive = true, FBAccessToken = fbAccessToken }; context.Owners.InsertOnSubmit(owner); context.SubmitChanges(); return ownerId; } }
partial void DeleteOwner(Owner instance);
partial void UpdateOwner(Owner instance);
partial void InsertOwner(Owner instance);