Beispiel #1
0
        public void AddBook(string tam, string name, int idpub)
        {
            Guid idUs = (from datos in ctx.aspnet_Users where datos.UserName == name select datos.UserId).ToArray()[0];
            int? idPer = (from per in ctx.libros select per.id).Max();
            int id;
            if (idPer == null)
                id = 1;
            else
            {
                id = idPer.Value;
                id += 1;
            }
            libro book = new libro() {
                id = id,
                autor = autor,
                idioma = idioma,
                tamano = tam,
                paginas = paginas,
                tema = tema,
                avatar = avatar,
                id_publicacion = idpub
            };

            ctx.libros.InsertOnSubmit(book);
            ctx.SubmitChanges();
        }
 partial void Deletelibro(libro instance);
 partial void Updatelibro(libro instance);
 partial void Insertlibro(libro instance);
		private void detach_libros(libro entity)
		{
			this.SendPropertyChanging();
			entity.publicacion = null;
		}