public JsonResult Get(int id) { OwnerResponse response = null; Owner owner = db.Owners.Where(x => x.OwnerID == id).FirstOrDefault(); if (owner != null) { response = new OwnerResponse(); response.OwnerID = owner.OwnerID; response.Type = owner.Type; response.Name = owner.Name; response.UnitNr = owner.UnitNr; response.ComplexName = owner.ComplexName; response.StreetNumber = owner.StreetNumber; response.StreeName = owner.StreetName; response.Suburb = owner.Suburb; response.City = owner.City; response.PostalCode = owner.PostalCode; response.TelWork = owner.TelWork; response.TelMobile = owner.TelMobile; response.Fax = owner.Fax; response.Email = owner.Email; response.Website = owner.Website; response.Title = owner.Title; response.FirstName = owner.FirstName; response.SecondName = owner.SecondName; response.ThirdName = owner.ThirdName; response.LastName = owner.LastName; response.IDNumber = owner.IDNumber; } return Json(response, JsonRequestBehavior.AllowGet); }
public static Owner Create(OwnerResponse response) { if (response == null) return null; Owner owner = new Owner(); owner.OwnerID = response.OwnerID; owner.Type = response.Type; owner.Name = response.Name; owner.UnitNr = response.UnitNr; owner.ComplexName = response.ComplexName; owner.StreetNumber = response.StreetNumber; owner.StreetName = response.StreeName; owner.Suburb = response.Suburb; owner.City = response.City; owner.PostalCode = response.PostalCode; owner.TelWork = response.TelWork; owner.TelMobile = response.TelMobile; owner.Fax = response.Fax; owner.Email = response.Email; owner.Website = response.Website; owner.Title = response.Title; owner.FirstName = response.FirstName; owner.SecondName = response.SecondName; owner.ThirdName = response.ThirdName; owner.LastName = response.LastName; owner.IDNumber = response.IDNumber; return owner; }