public static string GetContactsViewItem(RestCommand command, int userID) { ContactsViewItem contactsViewItem = ContactsView.GetContactsViewItem(command.LoginUser, userID); if (contactsViewItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(contactsViewItem.GetXml("ContactsViewItem", true)); }
public static string DeleteContact(RestCommand command, int id) { ContactsViewItem user = ContactsView.GetContactsViewItem(command.LoginUser, id); if (user == null) { throw new RestException(HttpStatusCode.BadRequest); } Organization organization = Organizations.GetOrganization(command.LoginUser, user.OrganizationID); if (organization.ParentID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } string result = user.GetXml("Contact", true); Users.MarkUserDeleted(command.LoginUser, id); return(result); }