public string Get(int id) { Admin.Profile profile = ViewBag.profile ?? new Admin.Profile(); TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById(profile.timezone ?? "UTC"); try { ContactInquiry inq = new ContactInquiry{ ID = id }; ContactInquiry resp = inq.Get(); SimpleInquiry simple = new SimpleInquiry { ID = resp.ID, name = resp.name, phone = resp.phone, message = resp.message, email = resp.email, type = (resp.ContactType != null && resp.ContactType.label != null) ? resp.ContactType.label : "N/A", dateAdded = String.Format("{0:M/dd/yyyy} at {0:h:mm tt}", TimeZoneInfo.ConvertTimeFromUtc(resp.dateAdded, tz)) + " " + UDF.ShortTZ(tz, resp.dateAdded), followedUp = resp.followedUp }; return JsonConvert.SerializeObject(simple); } catch (Exception e) { Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; Response.StatusDescription = e.Message; Response.Write(e.Message); return e.Message; } }
public string Get(int id) { try { ContactInquiry inq = new ContactInquiry{ ID = id }; ContactInquiry resp = inq.Get(); SimpleInquiry simple = new SimpleInquiry { ID = resp.ID, name = resp.name, phone = resp.phone, message = resp.message, email = resp.email, type = (resp.ContactType != null && resp.ContactType.label != null) ? resp.ContactType.label : "N/A", dateAdded = resp.dateAdded, followedUp = resp.followedUp }; return JsonConvert.SerializeObject(simple); } catch (Exception e) { Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; Response.StatusDescription = e.Message; Response.Write(e.Message); return e.Message; } }