public void Destroy(PlantillasBoletosPapelViewModel obj) { var entity = entities.PlantillaBoletosPapels.Where(c => c.Id == obj.Id).FirstOrDefault(); if (entity != null) { try { entity.Activo = false; entity.IdRetiredby = obj.Auditoria.IdRetiredby; entity.DateRetired = obj.Auditoria.DateRetired; entities.SaveChanges(); } catch (Exception err) { err.Message.ToString(); } } }
public void Create(PlantillasBoletosPapelViewModel obj) { var entity = new PlantillaBoletosPapel(); try { entity.Nombre = obj.Nombre; entity.Descripcion = obj.Descripcion; entity.IdTipoBoletoPapel = obj.IdTipoBoletoPapel; entity.IdCreatorby = obj.Auditoria.IdCreatorby; entity.DateCreated = obj.Auditoria.DateCreated; entity.Activo = true; entities.Add(entity); entities.SaveChanges(); } catch (Exception err) { err.Message.ToString(); } }
public void Update(PlantillasBoletosPapelViewModel obj) { var entity = entities.PlantillaBoletosPapels.Where(c => c.Id == obj.Id).FirstOrDefault(); if (entity != null) { try { entity.Nombre = obj.Nombre; entity.Descripcion = obj.Descripcion; entity.IdTipoBoletoPapel = obj.IdTipoBoletoPapel; entity.IdChangedby = obj.Auditoria.IdChangedby; entity.DateChanged = obj.Auditoria.DateChanged; entities.Add(entity); entities.SaveChanges(); } catch (Exception err) { err.Message.ToString(); } } }