Esempio n. 1
0
 public static Event FromDbEntity(SqlEntities.Event sqlEvent, User creator)
 {
     return(new Event
     {
         Id = sqlEvent.Id,
         CreatedBy = creator,
         Timestamp = sqlEvent.Timestamp,
         Description = sqlEvent.Description,
         Original = sqlEvent.Original,
         Updated = sqlEvent.Updated,
         EventType = sqlEvent.EventType
     });
 }
        public void Create([FromBody] Event newEvent)
        {
            var sqlEvent = new SqlEntities.Event
            {
                Description = newEvent.Description,
                //Adjust for timezone here - it's dirty but works for us
                Timestamp = newEvent.Timestamp.AddHours(-4),
                UserId    = newEvent.CreatedBy.Id,
                Original  = newEvent.Original,
                Updated   = newEvent.Updated,
                EventType = newEvent.EventType
            };

            GetDbContext().Insert(sqlEvent);
        }