public static string GetPhoneNumbersViewItem(RestCommand command, int phoneID) { PhoneNumbersViewItem phoneNumbersViewItem = PhoneNumbersView.GetPhoneNumbersViewItem(command.LoginUser, phoneID); if (phoneNumbersViewItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(phoneNumbersViewItem.GetXml("PhoneNumbersViewItem", true)); }
public static string AddPhoneNumber(RestCommand command, ReferenceType refType, int refID) { if (!DataUtils.IsReferenceValid(command.LoginUser, refType, refID)) { throw new RestException(HttpStatusCode.Unauthorized); } PhoneNumbers items = new PhoneNumbers(command.LoginUser); PhoneNumber item = items.AddNewPhoneNumber(); item.ReadFromXml(command.Data, true); item.RefType = refType; item.RefID = refID; item.Collection.Save(); return(PhoneNumbersView.GetPhoneNumbersViewItem(command.LoginUser, item.PhoneID).GetXml("PhoneNumber", true)); }
public static string GetPhoneNumber(RestCommand command, ReferenceType refType, int refID, int phoneID) { PhoneNumbersViewItem item = PhoneNumbersView.GetPhoneNumbersViewItem(command.LoginUser, phoneID); if (item.RefType != refType && item.RefID != refID) { throw new RestException(HttpStatusCode.Unauthorized); } if (!DataUtils.IsReferenceValid(command.LoginUser, refType, refID)) { throw new RestException(HttpStatusCode.Unauthorized); } return(item.GetXml("PhoneNumber", true)); }