public bool UpdateMedWorker(MedWorker MedWorker) { using (ApplicationContext context = new ApplicationContext()) { try { context.MedWorkers.Update(MedWorker); context.SaveChanges(); return(true); }catch (Exception e) { Console.WriteLine(e.Message); return(false); } } }
public int CreateMedWorker(MedWorker MedWorker) { using (ApplicationContext context = new ApplicationContext()) { try { context.MedWorkers.Add(MedWorker); context.SaveChanges(); return(MedWorker.Id); }catch (Exception e) { Console.WriteLine(e.Message); return(-1); } } }