How to save and retrieve image contents in bytes using Angular, Asp.Net Web API and Sql Server DB

Опубликовано: 28 Сентябрь 2024
на канале: World Tech Tube
7,906
62

Share, Support, Subscribe!!
Subscribe: https://bit.ly/3kk36Nh
Youtube:    / worldtechtube  


Source Code:
Server side(Asp.net Web API): https://github.com/worldtechtube/Save...
Client side (Angular project): https://github.com/worldtechtube/Save...

See how to upload files in angular:
   • How to upload files using Angular & A...  

   • Angular 9 Tutorial for Beginners: Lea...  


Agenda:

1. we will design the wallpaper table where we will save the wallpaper image content.
2. we will design the stored procedure to save the wallpaper image content to database.
3. we will try to save the image in sql server database.
4. we will try to get the images in custom object Wallpaper (id, wallpaperContent).
5. we will try to get the single image via HTTPResponseMessage through header content type.

Stored Procedure:
CREATE PROCEDURE dbo.Wallpaper_insert
(
@id INT
, @wallpaperContent VARBINARY(MAX)
)
AS
BEGIN
SET NOCOUNT ON;

INSERT INTO dbo.wallpaper
( id
, wallpaperContent
)
VALUES
( @id
, @wallpaperContent
);
END;

#angular #WebAPI #SqlServerDB