public async Task <IActionResult> EditPerson(int businessEntityID, [FromBody] Person.Person value) { var existing = await _db.Person_Person.FirstOrDefaultAsync(x => x.BusinessEntityID == businessEntityID); if (existing == null) { return(NotFound()); } existing.BusinessEntityID = value.BusinessEntityID; existing.PersonType = value.PersonType; existing.NameStyle = value.NameStyle; existing.Title = value.Title; existing.FirstName = value.FirstName; existing.MiddleName = value.MiddleName; existing.LastName = value.LastName; existing.Suffix = value.Suffix; existing.EmailPromotion = value.EmailPromotion; existing.AdditionalContactInfo = value.AdditionalContactInfo; existing.Demographics = value.Demographics; existing.rowguid = value.rowguid; existing.ModifiedDate = value.ModifiedDate; _db.Person_Person.Update(existing); await _db.SaveChangesAsync(); return(NoContent()); }
public async Task <IActionResult> CreatePerson([FromBody] Person.Person value) { _db.Person_Person.Add(value); await _db.SaveChangesAsync(); return(Ok(value)); }
public SearchResult(ResultElement resultElement) { if (resultElement.user.name != null) { _person = new Person.Person(resultElement.user); _person.PropertyChanged += PersonOnPropertyChanged; } }
public void TestPropertyAge_True(string stingBirthDay, int age) { //arrange ResetStandart(); DateTime birthDay; if (stingBirthDay.ToLower().Contains("now")) { int[] date = new int[3] { DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year }; string[] str = stingBirthDay.ToLower().Split('.'); for (int i = 0; i < 3; i++) { if (str[i].Contains("now")) { if (str[i].Contains("-")) { string[] a = str[i].Split('-'); date[i] -= Convert.ToInt32(a[1]); } else if (str[i].Contains("+")) { string[] a = str[i].Split('+'); date[i] += Convert.ToInt32(a[1]); } else if (str[i].Equals("now")) { } else { throw new Exception(); } } else { date[i] = Convert.ToInt32(str[i]); } } birthDay = new DateTime(date[2], date[1], date[0]); } else { birthDay = DateTime.Parse(stingBirthDay); } //act var person = new Person.Person(standatrName, standatrGender, birthDay, standatrLiving); //assert Assert.AreEqual(age, person.Age); }
// public string Name; // public Visa.Status StatusC; // public Person.Person Person; // public PersonC2(Person.Person person){ // Name = person.Name; // StatusC = person.Status; // } // public Visa.Status status2 = Visa.Status.Student; public static FSharpResult <Person.Person, string> ValidateStudentC(Person.Person person) { if (person.Status == Visa.Status.Student) { return(FSharpResult <Person.Person, string> .NewOk(person)); } else { return(FSharpResult <Person.Person, string> .NewError("Tourist")); } }
static void Main(string[] args) { // One can define a variable from the DU in F# Visa.Status studentVisa = Visa.Status.Student; // New instances of Person type from F# module Person.Person tourist = new Person.Person("John C. Doe", Visa.Status.Tourist); // Person.Person student = new Person.Person("Mary C. Eod", studentVisa); // One can also instantiate a Person directly from a record in the F# module Person.Person defaultStudent = Person.defaultStudent; // Call to ValidateStudent function in F# var resultOk = Person.ValidateStudent(defaultStudent); // C# sets the member .IsOk to True and .IsError to False // when ValidateStudent (returns Ok Person.Person) // person can be accessed through .ResultValue, // while .ErrorValue is null if (resultOk.IsOk) { Console.WriteLine($"{resultOk.ResultValue.Name} is a student"); Console.WriteLine($" resultOk.IsOk : {resultOk.IsOk}"); Console.WriteLine($" resultOk.IsError: {resultOk.IsError}"); } if (resultOk.ErrorValue is null) { Console.WriteLine($" resultOk.ErrorValue is null"); } // On the other hand, // C# sets the member .IsOk to False and .IsError to True // when ValidateStudent (returns Error string) // string can be accessed through .ErrorValue, // while .ResultValue is null var resultError = Person.ValidateStudent(tourist); if (resultError.IsError) { Console.WriteLine($"{tourist.Name} is a {resultError.ErrorValue}"); Console.WriteLine($" resultOk.IsOk : {resultOk.IsOk}"); Console.WriteLine($" resultOk.IsError: {resultOk.IsError}"); } if (resultError.ResultValue is null) { Console.WriteLine($" resultError.ResultValue is null"); } }
public void TestStandartValue() { ResetStandart(); //arrange //act var person = new Person.Person(standatrName, standatrGender, standatrBirthDay, standatrLiving); //assert Assert.AreEqual(standatrName, person.Name); Assert.AreEqual(standatrGender, person.Gender); Assert.AreEqual(standatrBirthDay, person.BirthDay); Assert.AreEqual(standatrAge, person.Age); Assert.AreEqual(standatrLiving, person.Living); }
public static void SaveGame(Person.Person t) { string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); using (StreamWriter s = new StreamWriter(mydocpath + @"/save.txt")) { s.WriteLine(t.name + ";" + t.attack + ";" + t.health + ";" + t.armor); } Console.Write("Press Enter to Quit ..."); Console.ReadLine(); Environment.Exit(0); }
public static void Map(this Person.Person entityObj, ContactDomainObj domainObj) { entityObj.BusinessEntityID = domainObj.BusinessEntityID; entityObj.PersonType = domainObj.PersonType; entityObj.IsEasternNameStyle = domainObj.IsEasternNameStyle; entityObj.Title = domainObj.Title; entityObj.FirstName = domainObj.FirstName; entityObj.MiddleName = domainObj.MiddleName; entityObj.LastName = domainObj.LastName; entityObj.Suffix = domainObj.Suffix; entityObj.EmailPromotion = domainObj.EmailPromotion; entityObj.AdditionalContactInfo = domainObj.AdditionalContactInfo; entityObj.Demographics = domainObj.Demographics; }
public void TestConstructor_True(string name, string stingBirthDay, string living) { //arrange ResetStandart(); Gender gender = standatrGender; DateTime birthDay = DateTime.Parse(stingBirthDay); //act var person = new Person.Person(name, gender, birthDay, living); //assert Assert.AreEqual(name, person.Name); Assert.AreEqual(gender, person.Gender); Assert.AreEqual(birthDay, person.BirthDay); Assert.AreEqual(living, person.Living); }
public void TestConstructor_Exception(string name, string stingBirthDay, string living, Type result) { ResetStandart(); DateTime birthDay = DateTime.Parse(stingBirthDay); Type exception = null; //arrange try { //act var person = new Person.Person(name, standatrGender, birthDay, living); } catch (Exception ex) { //assert exception = ex.GetType(); } finally { Assert.AreEqual(result, exception); } }
private static Func <Person.Person, bool> PersonIsNotTheSame(Person.Person person) => p => p != person;
public BirthdayDifference(Person.Person p1, Person.Person p2) { YoungerPerson = p1.BirthDate < p2.BirthDate ? p1 : p2; OlderPerson = YoungerPerson == p1 ? p2 : p1; Difference = OlderPerson.BirthDate - (YoungerPerson.BirthDate); }
public Login(Person.Person p) { _users = new Dictionary <string, string>(); this.P = p; }
private IEnumerable <BirthdayDifference.Model.BirthdayDifference> CreateBirthdayDifferenceWithOtherPersons( Person.Person person) => _persons.Where(PersonIsNotTheSame(person)) .Select(p => new Model.BirthdayDifference(person, p));
public PersonC(Person.Person person) { Name = person.Name; Status = person.Status; }
public Login(Person.Person p) { _users = new Dictionary<string, string>(); this.P = p; }
static void Main() { Console.WriteLine("Begin"); //Gender.Gender gender = new Gender.Gender("мужской"); //var genders = new List<Gender.Gender> //{ // new Gender.Gender("мужской"), // new Gender.Gender("женский"), //}; ClassRoom.ClassRoom classRoom = new ClassRoom.ClassRoom("Аудит1", 101); var classRooms = new List <ClassRoom.ClassRoom> { new ClassRoom.ClassRoom("Аудит1", 50), new ClassRoom.ClassRoom("Аудит2", 34), new ClassRoom.ClassRoom("Аудит3", 45), new ClassRoom.ClassRoom("Аудит4", 107), new ClassRoom.ClassRoom("Аудит5", 31), }; Group.Group group = new Group.Group("TBO", 2, "TBO-2", Interface.Interface.TypeStudy.FullTimeEducation, 35); var groups = new List <Group.Group> { new Group.Group("TBO", 1, "TBO-1", Interface.Interface.TypeStudy.FullTimeEducation, 35), new Group.Group("TBO", 2, "TBO-2", Interface.Interface.TypeStudy.FullTimeEducation, 25), new Group.Group("TMO", 3, "TMO-3", Interface.Interface.TypeStudy.FullTimeEducation, 11), new Group.Group("TCO", 2, "TCO-2", Interface.Interface.TypeStudy.FullTimeEducation, 54), }; Subject.Subject subject = new Subject.Subject("Математика"); var subjects = new List <Subject.Subject> { new Subject.Subject("программирование 2 курс"), new Subject.Subject("математический анализ 3 курс"), new Subject.Subject("введение в специальность 1 курс"), new Subject.Subject("история России 1-4 курс"), }; NumberOfLesson.NumberOfLesson numberOfLesson = new NumberOfLesson.NumberOfLesson(subject, 5); var numberOfLessons = new List <NumberOfLesson.NumberOfLesson> [groups.Count]; for (int i = 0; i < groups.Count; i++) { int r1 = i * 5 % subjects.Count; int r2 = i * 3 % subjects.Count; if (r1 == r2) { r1 = (r1 + 1) % subjects.Count; } var tempNumberOfLessons = new List <NumberOfLesson.NumberOfLesson> { new NumberOfLesson.NumberOfLesson(subjects[r1], 7), new NumberOfLesson.NumberOfLesson(subjects[r2], 9), }; numberOfLessons[i] = tempNumberOfLessons; } ; Semester.Semester semester = new Semester.Semester(new DateTime(2019, 02, 02), new DateTime(2019, 05, 31)); DaysOfStudy.DaysOfStudy daysOfStudy = new DaysOfStudy.DaysOfStudy(DateTime.Now, Interface.Interface.HowDays.DayOff); Person.Person person = new Person.Person("Dima", Interface.Interface.Gender.men, new DateTime(1996, 05, 19), "Юго западная"); SubjectOfTeacher.SubjectOfTeacher subjectOfTeacher = new SubjectOfTeacher.SubjectOfTeacher(subject, 10); Teacher.Teacher teacher = new Teacher.Teacher(new List <SubjectOfTeacher.Interfaces.ISubjectOfTeacherWithConsole> { subjectOfTeacher }, "none", 1, person); var teachers = new List <Teacher.Teacher>(); string[] names = { "Александр", "Максим", "Виктор", "Дмитрий", "Олег" }; for (int i = 0; i < 5; i++) { int r1 = i * 5 % subjects.Count; int r2 = i * 3 % subjects.Count; if (r1 == r2) { r1 = (r1 + 1) % subjects.Count; } var subjectOfTeacher1 = new List <SubjectOfTeacher.Interfaces.ISubjectOfTeacherWithConsole> { new SubjectOfTeacher.SubjectOfTeacher(subjects[r1], 100), new SubjectOfTeacher.SubjectOfTeacher(subjects[r2], 100), }; var person1 = new Person.Person(names[i], genders[0], new DateTime(1958 + i, (17 * i) % 12 + 1, (23 * i) % 28 + 1), "Not info"); var teacher1 = new Teacher.Teacher(subjectOfTeacher1, "none", 1, person1); teachers.Add(teacher1); } TimeLessons.TimeLessons timeLessons = new TimeLessons.TimeLessons(new TimeSpan(09, 00, 00), new TimeSpan(10, 30, 00), 1); var timeLessonss = new List <TimeLessons.TimeLessons> { new TimeLessons.TimeLessons(new TimeSpan(09, 00, 00), new TimeSpan(10, 30, 00), 1), new TimeLessons.TimeLessons(new TimeSpan(10, 40, 00), new TimeSpan(12, 10, 00), 2), new TimeLessons.TimeLessons(new TimeSpan(13, 00, 00), new TimeSpan(14, 30, 00), 3), new TimeLessons.TimeLessons(new TimeSpan(14, 40, 00), new TimeSpan(16, 10, 00), 4), new TimeLessons.TimeLessons(new TimeSpan(16, 20, 00), new TimeSpan(17, 50, 00), 5), new TimeLessons.TimeLessons(new TimeSpan(18, 00, 00), new TimeSpan(19, 30, 00), 6), }; TypeLessons.TypeLessons typeLessons = new TypeLessons.TypeLessons("Лекция"); var typeLessonss = new List <TypeLessons.TypeLessons> { new TypeLessons.TypeLessons("Лекция"), new TypeLessons.TypeLessons("Практика"), }; Console.WriteLine("Вы вышли в основную программу!"); Console.ReadLine(); }
//если есть эта надпись значит я не доделал static void Main(string[] args) { //для задания 1. Описпание в классе Person Person.Person person = new Person.Person("MyName", "MySname", 25); Console.WriteLine(Person.Person.method1(person)); //для задания 2. Описание в классе Task2 Console.WriteLine(Task2.Task2.field1 + " " + Task2.Task2.field2 + " " + Task2.Task2.field3); List <Bankomat.Account> listAcc = new List <Bankomat.Account>(); while (true) { Console.WriteLine("У вас есть аккаунт?\n1. Создать новый\n2. Войти в существующий\nquit чтобы выйти"); int choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: createAccount(); break; case 2: enterAccount(); break; } Console.ReadKey(); Console.Clear(); } void createAccount() { Console.WriteLine("Введите ваше имя: "); string name = (Console.ReadLine()); Console.WriteLine("Введите вашу фамилию: "); string sname = (Console.ReadLine()); Console.WriteLine("Введите ваш возраст: "); int age = int.Parse(Console.ReadLine()); Console.WriteLine("Введите первоначальный взнос: "); double money = double.Parse(Console.ReadLine().Replace('.', ',')); Bankomat.Account account = new Bankomat.Account(name, sname, age, money); listAcc.Add(account); } void blockAcc(int id) { foreach (var item in listAcc) { if (item.getid(item) == id) //знаю, говнокод { item.blockAcc(item); //знаю, говнокод } } } void showMenu() { } bool checkAcc(int id, int pass) { return(true); } void enterAccount() { while (true) { Console.WriteLine("Введите id:"); int id = int.Parse(Console.ReadLine()); Console.WriteLine("Введите password:"******"Некорректные данные\nОсталось попыток: " + count); count--; } } } }
/// <summary>Adds a new person object to the list of vehicle passengers.</summary> /// <param name="person">Person that wishes to become a vehicle passenger.</param> public void AddPerson(Person.Person person) { _passengers.Add(person); }
public List <Person.Person> GetChildren(Person.Person person) { return(Members.Where(m => m.FatherId == person.Id || m.MotherId == person.Id).ToList()); }
public void TestToString_True(string name, string stingGender, string stingBirthDay, string living, string toSting) { //arrange ResetStandart(); Gender gender = Gender.women; if (stingGender == "men") { gender = Gender.men; } DateTime birthDay; if (stingBirthDay.ToLower().Contains("now")) { int[] date = new int[3] { DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year }; string[] str = stingBirthDay.ToLower().Split('.'); for (int i = 0; i < 3; i++) { if (str[i].Contains("now")) { if (str[i].Contains("-")) { string[] a = str[i].Split('-'); date[i] -= Convert.ToInt32(a[1]); } else if (str[i].Contains("+")) { string[] a = str[i].Split('+'); date[i] += Convert.ToInt32(a[1]); } else if (str[i].Equals("now")) { } else { throw new Exception(); } } else { date[i] = Convert.ToInt32(str[i]); } } birthDay = new DateTime(date[2], date[1], date[0]); } else { birthDay = DateTime.Parse(stingBirthDay); } //act var person = new Person.Person(name, gender, birthDay, living); //assert Assert.AreEqual(toSting, person.ToString()); }