public string saveVideo(linkMap video) { if (video.id == 0) { context.linkMaps.Add(video); } else { linkMap dbEntry = context.linkMaps.Find(video.id); if (dbEntry != null) { dbEntry.link = video.link; dbEntry.typeMap = video.typeMap; dbEntry.mota = video.mota; } } try { context.SaveChanges(); return(""); } catch (Exception ex) { return(ex.Message); } }
public string deleteVideo(int id) { linkMap Video = context.linkMaps.Find(id); string result = ""; if (Video != null) { try { context.linkMaps.Remove(Video); context.SaveChanges(); } catch (Exception ex) { result = ex.Message; } } return(result); }