/// <summary> /// This will convert the internal ListShare to a API version with the associated List object /// </summary> /// <param name="listShare"></param> /// <returns></returns> public API_ListShare ConvertToAPI_ListShareWithoutAssociatedList(GyftoList.Data.ListShare listShare) { var apiShare = GetShellListShare(listShare); var apiList = new API_List(); return apiShare; }
/// <summary> /// This will convert the internal ListShare to a API version with the associated List object /// </summary> /// <param name="listShare"></param> /// <returns></returns> public API_ListShare ConvertToAPI_ListShareWithAssociatedList(GyftoList.Data.ListShare listShare) { var apiShare = GetShellListShare(listShare); var apiList = new API_List(); apiShare.SharedList = apiList.ConvertToAPI_ListWithAllItems(listShare.List); return apiShare; }
/// <summary> /// Creates a new shell API_List object. /// </summary> /// <param name="list"></param> /// <returns></returns> private API_List _CreateShellList(GyftoList.Data.List list) { return new API_List { PublicKey = list.PublicKey, Description = list.Description, ListName = list.Title, UserPublicKey = list.User.PublicKey, CreateDate = list.CreateDate }; }
/// <summary> /// This will convert the internal ItemShare to a API version /// </summary> /// <param name="itemShare"></param> /// <param name="listShare"></param> /// <param name="consumer"></param> /// <param name="item"></param> /// <returns></returns> public API_ItemShare ConvertToAPI_ItemShare(GyftoList.Data.ItemShare itemShare, GyftoList.Data.ListShare listShare, GyftoList.Data.User consumer, GyftoList.Data.Item item) { API_ItemShare rcItemShare; try { rcItemShare = new API_ItemShare(); rcItemShare.PublicKey = itemShare.PublicKey; rcItemShare.ItemPublicKey = item.PublicKey; rcItemShare.ConsumerAvatarURL = consumer.AvatarURL; rcItemShare.ConsumerPublicKey = consumer.PublicKey; rcItemShare.ConsumerDisplayName = string.Format("{0} {1}",consumer.FName,consumer.LName.Substring(0,1)); rcItemShare.ListSharePublicKey = listShare.PublicKey; } catch (Exception ex) { throw ex; } return rcItemShare; }
/// <summary> /// Creates an API_List object without associated List Items /// </summary> /// <param name="list"></param> /// <returns></returns> public API_List ConvertToAPI_ListWithoutItems(GyftoList.Data.List list) { var rcList = _CreateShellList(list); return rcList; }