示例#1
0
 private static PersonAntroModel GetPersonAntroModel(PersonAntro antroEntity)
 {
     return(antroEntity != null ? new PersonAntroModel
     {
         Id = antroEntity.Id,
         IdPerson = antroEntity.id_Person,
         IdAntro = antroEntity.id_Antro,
         Value = antroEntity.Value,
         AntroName = antroEntity.AntroName.Name
     } : new PersonAntroModel());
 }
示例#2
0
 /// <see cref="IPersonRepository.UpdatePersonAntro" />
 public PersonAntro UpdatePersonAntro(PersonAntro property, int userId)
 {
     if (property.Id == 0)
     {
         db.Entry(property).State = System.Data.Entity.EntityState.Added;
     }
     else if (property.Id > 0)
     {
         var pr = db.PersonAntro.FirstOrDefault(o => o.Id == property.Id);
         SaveLog(pr, property, property.id_Person, userId, LogType.Anthropometry);
         db.Entry(pr).CurrentValues.SetValues(property);
     }
     try
     {
         db.SaveChanges();
     }
     catch (Exception e)
     {
         return(null);
     }
     return(property);
 }
示例#3
0
        /// <see cref="IPersonRepository.AddPersonAntros(PersonAntro, int)" />
        public int AddPersonAntros(PersonAntro property, int userId)
        {
            var res = UpdatePersonAntro(property, userId);

            return(res?.Id ?? -1);
        }