0

I'm having a client, and it sending the following Signature to the Library

Client UI Signature :

namespace Library.Model
{
    public class Person
    {
        public int PersonId { get; set; }
        public string Name { get; set; }
        public string streetName { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
}

Library DB Structure:

namespace Library.Data
{
    public class Person
    {
        public int PersonId { get; set; }
        public string Name { get; set; }
        public int AddressId { get; set; }
        public Address AddressInfo { get; set; }
    }

    public class Address
    {
        public int AddressId { get; set; }
        public string streetName { get; set; }
        public string City { get; set; }
        public string State { get; set; }
    }
}

Here I'm doing the mapping process from Client UI model to DB Structured model. How could I use the DB structured model as like Client model instead of the Client model.

Kindly assist me how efficiently we can share the DB Structured model in Client?

Note: But the Client the Signature should be

public class Person
{
    public int PersonId { get; set; }
    public string Name { get; set; }
    public string streetName { get; set; }
    public string City { get; set; }
    public string State { get; set; }
}

Kindly refer Update a class property based on another Property of a calss properties value in the Setter - I need the solution similar to this.

Community
  • 1
  • 1

1 Answers1

0

i think you can use PersonViewModel to make this and it will be like you mention

public class PersonViewModel 
{
    public int PersonId { get; set; }
    public string Name { get; set; }
    public string streetName { get; set; }
    public string City { get; set; }
    public string State { get; set; }
}

Make join and file this object

PersonViewModel persons = new PersonViewModel ();

I wish it will help you :)

Omar Maher
  • 45
  • 4