public JsonResult Get(int id) { TenantResponse response = null; Tenant tenant = db.Tenants.Where(x => x.TenantID == id).FirstOrDefault(); if (tenant != null) { response = new TenantResponse(); response.TenantID = tenant.TenantID; response.Email = tenant.Email; response.FirstName = tenant.FirstName; response.IDNumber = tenant.IDNumber; response.LastName = tenant.LastName; response.PreferredName = tenant.PreferredName; response.SecondName = tenant.SecondName; response.TelMobile = tenant.TelMobile; response.TelWork = tenant.TelWork; response.ThirdName = tenant.ThirdName; response.Title = tenant.Title; response.Website = tenant.Website; } return Json(response, JsonRequestBehavior.AllowGet); }
public static Tenant Create(TenantResponse response) { if (response == null) return null; Tenant tenant = new Tenant(); tenant.TenantID = response.TenantID; tenant.Email = response.Email; tenant.FirstName = response.FirstName; tenant.IDNumber = response.IDNumber; tenant.LastName = response.LastName; tenant.PreferredName = response.PreferredName; tenant.SecondName = response.SecondName; tenant.TelMobile = response.TelMobile; tenant.TelWork = response.TelWork; tenant.ThirdName = response.ThirdName; tenant.Title = response.Title; tenant.Website = response.Website; return tenant; }