public void Create(IntoPrevention intoPrevention) { using (var context = new TesisContext()) { context.IntoPreventions.Add(intoPrevention); context.SaveChanges(); } }
public void Delete(IntoPrevention intoPrevention) { using (var context = new TesisContext()) { var intoPreventionDelete = context.IntoPreventions.SingleOrDefault(r => r.Id == intoPrevention.Id); context.IntoPreventions.Remove(intoPreventionDelete); context.SaveChanges(); } }
public IntoPrevention StoreIntoPrevention(IntoPrevention intoPrevention) { if (intoPrevention != null) { if (intoPrevention.Id == 0) { _intoPreventionDao.Create(intoPrevention); } else { _intoPreventionDao.Update(intoPrevention); } } return(intoPrevention); }
public void Update(IntoPrevention intoPrevention) { using (var context = new TesisContext()) { var intoPreventionUpdate = context.IntoPreventions.SingleOrDefault(r => r.Id == intoPrevention.Id); if (intoPreventionUpdate != null) { intoPreventionUpdate.PreventionId = intoPrevention.PreventionId; intoPreventionUpdate.Kind = intoPrevention.Kind; intoPreventionUpdate.Title = intoPrevention.Title; intoPreventionUpdate.Description = intoPrevention.Description; intoPreventionUpdate.Prevention = intoPrevention.Prevention; } context.SaveChanges(); } }