Ejemplo n.º 1
0
 private static EventFactModel GetFactModel(EventFact fact)
 {
     return(fact != null ? new EventFactModel
     {
         Id = fact.Id,
         id_Event = fact.id_Event,
         id_FactType = fact.id_FactType,
         FactType = new EventFactTypeModel {
             Id = fact.FactType.Id, Name = fact.FactType.Name, Descript = fact.FactType.Descript ?? ""
         },
         FactText = fact.FactText,
         Status = fact.Status,
         Source = fact.Source
     } : new EventFactModel());
 }
Ejemplo n.º 2
0
 /// <see cref="IPersonRepository.UpdatePersonFact" />
 public EventFact UpdateEventFact(EventFact fact, int userId)
 {
     if (fact.Id == 0)
     {
         db.Entry(fact).State = System.Data.Entity.EntityState.Added;
     }
     else if (fact.Id > 0)
     {
         var pr = db.EventFacts.FirstOrDefault(o => o.Id == fact.Id);
         SaveLog(pr, fact, fact.id_Event, userId, LogType.Fact);
         db.Entry(pr).CurrentValues.SetValues(fact);
     }
     try
     {
         db.SaveChanges();
     }
     catch (Exception e)
     {
         return(null);
     }
     return(fact);
 }