/// <summary> /// FROM ITEM DATA TO FORM DATA. /// </summary> /// <param name="itemData">the itemData to convert</param> /// <returns>the formdata result</returns> public static NewsFormData ToFormData(this NewsItemData itemData) { if (itemData == null) { return(new NewsFormData()); } NewsFormData formData = new NewsFormData { NewsId = itemData.NewsId, NewsDate = itemData.NewsDate.ToString("dd/MM/yyyy") }; return(formData); }
/// <summary> /// FROM FROMDATA TO ITEMDATA. /// </summary> /// <param name="formData">the formdata to convert</param> /// <returns>the item data.</returns> public static NewsItemData ToItemData(this NewsFormData formData) { if (formData == null) { return(new NewsItemData()); } NewsItemData itemData = new NewsItemData { NewsImage = formData.NewsImage?.FileName, NewsId = formData.NewsId, NewsDate = new DateTime(int.Parse(formData.NewsDate.Split('/')[2]), int.Parse(formData.NewsDate.Split('/')[1]), int.Parse(formData.NewsDate.Split('/')[0])) }; return(itemData); }
public void Post([FromBody] NewsItemData value) { }