public void WriteXml(XmlWriter i_Writer) { i_Writer.WriteAttributeString("Name", Name); i_Writer.WriteAttributeString("PostPriority", PostPriority.ToString()); i_Writer.WriteStartElement("PostFilters"); foreach (IPostFilter postFilter in r_PostFilters) { XmlSerializer serializer = new XmlSerializer(postFilter.GetType()); serializer.Serialize(i_Writer, postFilter); } i_Writer.WriteEndElement(); }
public static async Task Init_1Post( InTouchContext context, string title, int daysOld, PostPriority priority) { daysOld *= -1; var user = await InitOneGeneralUserAsync(context); var post = new Post { Content = "Content1", CreatedDate = DateTime.Now.AddDays(daysOld), IsDeleted = false, IsPublic = true, Title = title, UserId = user.Id, Priority = priority, StartDateTime = DateTime.Now.AddDays(daysOld), EndDateTime = DateTime.Now.AddDays(Math.Abs(daysOld) + 50), }; context.Posts.Add(post); context.SaveChanges(); }