public static int DeleteClick(ClickViewModel click) { try { // Convert the view model object to a service proxy object. SP.ClickSvc.Click request = click.ToModel(); // Call the service delete method. _clickClient.DeleteClick(request); return 1; } catch (System.ServiceModel.FaultException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public void RemoveClick(ClickViewModel click) { _clickVMs.Remove(click); }
public void AddClick(ClickViewModel click) { _clickVMs.Add(click); }
public static int InsertClick(ClickViewModel click) { if (null == click) { throw new Exception("Cannot insert Click. The click object was null. Cannot be empty."); } try { // Convert the view model object to a service proxy object. SP.ClickSvc.Click request = click.ToModel(); // Call the service insert method. _clickClient.InsertClick(request); return 1; } catch (System.ServiceModel.FaultException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public static ClickCollection GetClicksForListingTypeByListingTypeGuid(Guid listingTypeGuid) { SP.ClickSvc.Click[] clicks = _clickClient.GetClicksForListingTypeByListingTypeGuid(listingTypeGuid); ClickCollection result = new ClickCollection(); foreach (SP.ClickSvc.Click click in clicks) { ClickViewModel viewModel = new ClickViewModel(click.ClickGuid, click.FacilityGuid, click.ListingTypeGuid, click.TimeStamp); result.Add(viewModel); } return result; }
/// <summary> /// Converts a Click service proxy object to a WebClient object. /// </summary> /// <param name="click">Click service proxy</param> /// <returns>Click WebClient object to be used in the UI.</returns> public static VM.ClickViewModel ToViewModel(this SP.ClickSvc.Click click) { VM.ClickViewModel result = new VM.ClickViewModel() { ClickGuid = click.ClickGuid, FacilityGuid = click.FacilityGuid, ListingTypeGuid = click.ListingTypeGuid, TimeStamp = click.TimeStamp, }; return result; }