public string Update(string input) { System.Console.WriteLine("Masukkan Nama Video : "); string nama_video = System.Console.ReadLine(); MsVideo video = GetById(input); video.NmVideo = nama_video; _context.Entry(video).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); return(input); }
public void Insert() { System.Console.Write("Masukkan Kode Video : "); string kode_video = System.Console.ReadLine(); System.Console.Write("Masukkan Nama Video : "); string nama_video = System.Console.ReadLine(); System.Console.Write("Produksi : "); string produksi = System.Console.ReadLine(); System.Console.Write("Jenis Video : "); int kode_jenis = Convert.ToInt16(System.Console.ReadLine()); System.Console.Write("Stok : "); int stok = Convert.ToInt16(System.Console.ReadLine()); System.Console.Write("Bahasa : "); string bahasa = System.Console.ReadLine(); MsVideo video = new MsVideo() { KdVideo = kode_video, NmVideo = nama_video, Produksi = produksi, JenisVideo = kode_jenis, Stok = stok, Bahasa = bahasa }; try { _context.MsVideos.Add(video); var result = _context.SaveChanges(); } catch (Exception ex) { System.Console.Write(ex.InnerException); } }