private void UpdateAuth(string cardPkId, IList <Device> devices) { var repo = new BaseRepo <CardAuth>(dbCtx); var existsList = repo.Find(t => t.Card == cardPkId); foreach (var e in existsList) { repo.Delete(e); } if (devices != null && devices.Count > 0) { var updateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (var dev in devices) { var entity = new CardAuth() { Card = cardPkId, Device = dev.PkId, UpdateTime = updateTime }; entity.NewId(); repo.Add(entity); } } }
public virtual bool Delete(IEnumerable <TEntity> entities) { using (var cxt = DbContext(DbOperation.Write)) { try { cxt.BeginTransaction(); var repo = new BaseRepo <TEntity>(cxt); var isSuccess = repo.Delete(entities); if (isSuccess) { cxt.Commit(); } else { cxt.Rollback(); } return(isSuccess); } catch (Exception ex) { cxt.Rollback(); return(false); } } }
public ActionResult Delete(int id) { T entity = repo.GetById(id); repo.Delete(entity); DeleteFilter(id); return(Redirect(entity)); }
private void PatientDelete() { _dialogService.ShowDialog("ClinicNotificationView", r => { if (r.Result == ButtonResult.Yes) { patRepo.Delete(SelectedPatient); Patients = new ObservableCollection <Patient>(patRepo.GetAll()); } }); }
private void DiagnosisDelete() { _dialogService.ShowDialog("ClinicNotificationView", r => { if (r.Result == ButtonResult.Yes) { diagRepo.Delete(SelectedDiagnosis); Diagnoses = new ObservableCollection <Diagnosis>(diagRepo.GetAll()); } }); }
public ActionResult Delete([Bind(Include = "Id, Timestamp")] Folder folder) { if (ModelState.IsValid) { _repo.Delete(folder); // _repo.Delete(_repo.GetOne(1)); return(RedirectToAction("Index")); } return(View(folder)); }
public ActionResult Delete(D model) { BaseRepo <T> repo = SetRepo(); T deletedItem = repo.GetById(model.Id); repo.Delete(deletedItem); ExtraDelete(deletedItem); return(RedirectToAction("Index")); }
public ActionResult BookDel(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { repo.Delete(id); return(new HttpStatusCodeResult(HttpStatusCode.OK)); } }
static void Main(string[] args) { BaseRepo <Car> cars = new BaseRepo <Car>(); WriteLine("******Cars******"); foreach (var car in cars.GetAll()) { WriteLine(car); } cars.Add(new Car { Make = "make1", Color = "color1", PetName = "name1" }); WriteLine("***Add car***"); cars.AddRange(new List <Car>() { new Car { Make = "make2", Color = "color2", PetName = "name2" }, new Car { Make = "make3", Color = "color3", PetName = "name3" } }); WriteLine("***Add cars***"); WriteLine("******Cars******"); foreach (var car in cars.GetAll()) { WriteLine(car); } cars.GetOne(1).Color = "blue"; WriteLine("***Update car***"); WriteLine("******Cars******"); foreach (var car in cars.GetAll()) { WriteLine(car); } cars.Delete(cars.GetOne(5)); WriteLine("***Delete car***"); WriteLine("******Cars******"); foreach (var car in cars.GetAll()) { WriteLine(car); } ReadKey(); }
public void Delete(T entity) { ProcessReceivers(entity, EventType.EntityDeleting); BaseRepo.Delete(entity); ProcessReceivers(entity, EventType.EntityDeleted); }
public void Delete(TType entity) { repo.Delete(entity); }
public int Delete(int id) { return(_menusRepo.Delete(id)); }
public ActionResult Delete([Bind(Include = "Id, Timestamp")] File file) { _repo.Delete(file); return(RedirectToAction("Index", "Folder")); }
public int Delete(int id, IDbTransaction transaction) { return(_staffsRepo.Delete(id)); }