/// <summary> /// FROM ITEM DATA TO FORM DATA. /// </summary> /// <param name="itemData">the itemData to convert</param> /// <returns>the formdata result</returns> public static CreatePublicationFormData ToCreateFormData(this PublicationItemData itemData) { if (itemData == null) { return(new CreatePublicationFormData()); } CreatePublicationFormData formData = new CreatePublicationFormData { PublicationDate = itemData.PublicationDate.ToString("dd/MM/yyyy"), AuthorId = itemData.AuthorId, AreaId = itemData.AreaId }; return(formData); }
/// <summary> /// FROM FROMDATA TO ITEMDATA. /// </summary> /// <param name="formData">the formdata to convert</param> /// <returns>the item data.</returns> public static PublicationItemData ToItemData(this CreatePublicationFormData formData) { if (formData == null) { return(new PublicationItemData()); } PublicationItemData itemData = new PublicationItemData { PublicationDate = formData.PublicationDate.StringToDateTime(), PublicationImage = formData.PublicationImage?.FileName, AuthorId = formData.AuthorId, AreaId = formData.AreaId }; return(itemData); }