public string SubmitApplication(string uName, string appID) { int userId = (from o in mVC201.Accounts where o.UserName == uName select o.ID).First(); var members = (from x in mVC201.RelationShips where x.AccountID == userId select x).ToList(); try { RelationShip relationShip = new RelationShip(); foreach (var member in members) { if (member.AccountID == userId) { member.ApplicationID += appID; } } mVC201.SaveChanges(); return("success"); } catch (Exception ex) { return(ex.Message); } }
public string SubmitRelationShip(RelationShip relationShip, string uName) { int userId = (from o in mVC201.Accounts where o.UserName == uName select o.ID).First(); try { relationShip.AccountID = userId; mVC201.RelationShips.Add(relationShip); mVC201.SaveChanges(); return("success"); } catch (Exception ex) { return(ex.Message); } }
public string SaveAppId(AddMember memberdata) { var member = (from x in mVC201.AddMembers where x.ApplicationID == memberdata.ApplicationID select x).ToList(); RelationShip relationShip = new RelationShip(); foreach (var item in member) { item.Suffix = memberdata.Suffix; item.FirstName = memberdata.FirstName; item.MiddleName = memberdata.MiddleName; item.LastName = memberdata.LastName; item.Gender = memberdata.Gender; item.DateOfBirth = memberdata.DateOfBirth; } if (mVC201.SaveChanges() == 1) { //mVC201.Entry(member).CurrentValues.SetValues(memberdata); return("Success"); } return("Failure"); }