예제 #1
0
        public int Save(PersonaModel model)
        {
            if (model.PersonaId == 0)
            {
                model.PersonaId = _db.Persona.Consecutivo(x => x.PersonaId);
                _db.Persona.Add(model.PersonaFactory());
            }
            else
            {
                _db.Entry(model.PersonaFactory()).State = EntityState.Modified;
            }

            _db.SaveChanges();

            return(model.PersonaId);
        }