public static Lawyer CreateLawyer(Person person) { var vakil = new Lawyer { Id = Guid.NewGuid(), StartDate = new DateTime(2012, 6, 12), Person = person, }; return vakil; }
public static Customer CreateCustomer(Person person) { var customer = new Customer { Id = Guid.NewGuid(), // Person = new Person(), Person = person, No = "1", }; return customer; }
public static Customer CreateCustomer(Person person,string no , float portion) { //Contract.Requires<ArgumentNullException>(person != null, "person"); var customer = new Customer { Id = Guid.NewGuid(), Person = person, No = no, Portion = portion, }; return customer; }
public static Lawyer CreateLawyer(Person person , DateTime startDate) { // Contract.Requires<ArgumentNullException>(person != null ,"person"); var lawyer = new Lawyer { Id = Guid.NewGuid(), StartDate = startDate, Person = person, }; return lawyer; }
/// <summary> /// person region /// </summary> /// <param name="personDto"></param> public string AddPerson(PersonDto personDto) { try { string nationalIdentity = personDto.NationalIdentity; PersonRepository repository = new PersonRepository(); if (repository.ActiveContext.Persons.Where(p => p.NationalIdentity == nationalIdentity).Count() != 0) return "person with this natinal identity is there "; personDto.CustomerId = repository.ActiveContext.Persons.Select(o => o.CustomerId).DefaultIfEmpty(0).Max() + 1; personDto.Id = Guid.NewGuid(); Person person = new Person(); person.InjectFrom<UnflatLoopValueInjection>(personDto); person.ContactInfo.InjectFrom<UnflatLoopValueInjection>(personDto); repository.Add(person); return "person is added successfully by customerId :" + personDto.CustomerId.ToString(); } catch (Exception exception) { return exception.Message; } }