public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in db.ShowDetails where sk.Show.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; var ark = from ak in db.ShowDetails where ak.Artist.ArtistName.Equals(sdl.ArtistNames) select new { ak.ArtistKey }; sd.ArtistKey = sdl.ArtistKey; sd.ShowKey = sdl.ShowKey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { db.ShowDetails.Add(sd); db.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return result; }
public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in st.Shows where sk.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; int skey = 0; foreach (var i in shk) { skey = (int)i.ShowKey; } var ark = from ak in st.Artists where ak.ArtistName.Equals(sdl.ArtistName) select new { ak.ArtistKey }; int akey = 0; foreach (var c in ark) { akey = (int)c.ArtistKey; } sd.ArtistKey = akey; sd.ShowKey = skey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { st.ShowDetails.Add(sd); st.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return(result); }
public int AddShowDetails(ShowDetailsLite sdl) { int result = 1; ShowDetail sd = new ShowDetail(); var shk = from sk in st.Shows where sk.ShowName.Equals(sdl.ShowName) select new { sk.ShowKey }; int skey = 0; foreach (var i in shk) { skey = (int)i.ShowKey; } var ark = from ak in st.Artists where ak.ArtistName.Equals(sdl.ArtistName) select new { ak.ArtistKey }; int akey = 0; foreach (var c in ark) { akey = (int)c.ArtistKey; } sd.ArtistKey = akey; sd.ShowKey = skey; sd.ShowDetailArtistStartTime = sdl.ShowDetailArtistStartTime; sd.ShowDetailAdditional = sdl.ShowDetailAdditional; try { st.ShowDetails.Add(sd); st.SaveChanges(); } catch (Exception ex) { result = 0; throw ex; } return result; }