public bool AddNewUser(UserDataContract Users) { try { UserTable user = db.UserTables.Create(); user.Name = Users.Name; user.Address = Users.City; user.City = Users.City; db.UserTables.Add(user); db.SaveChanges(); } catch (Exception ex) { throw new FaultException <string> (ex.Message); } return(true); }
public UserDataContract GetUserDetails(int Id) { UserDataContract User = new UserDataContract(); try { var query = (from a in db.UserTables where a.Id.Equals(Id) select a).Distinct().FirstOrDefault(); User.Id = query.Id; User.Name = query.Name; User.Address = query.Address; User.City = query.City; } catch (Exception ex) { throw new FaultException <string> (ex.Message); } return(User); }