I have a set of images and I tried to add them into a table (ImageGalleries) using EF Core. The insertion goes well. After the insertion I need IDs (there is an identity column in the table) of inserted records. I tried below post in StackOverflow. But I couldn't get reach.
public ActionResult Save(IEnumerable<IFormFile> images,RoomGalleryVM vm)
        {
            if (images!= null)
            {
                string fileName = "";
                foreach (var image in images)
                {
                    var fileContent = ContentDispositionHeaderValue.Parse(image.ContentDisposition);
                    fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
                    var gallery = new RoomGallery()
                    {
                        RoomId = vm.RoomId,
                        Description=fileName,
                        Status="A"
                    };
                    Context.RoomGalleries.Add(gallery);
                }
                Context.SaveChanges();
                //var Ids = vm.Select(c => c.Id).ToList();
            }
            return View("RoomGalleryIndex");
        }  
RoomGalleryVM
 public class RoomGallery
    {
        public int Id { get; set; }
        public int RoomId { get; set; }
        public Room Room { get; set; }
        [StringLength(100)] public string Description { get; set; }
        [StringLength(10)] public string Status { get; set; }
    }
Index page
<form method="post" asp-action="Save" asp-controller="RoomGallery">
<h6 style="margin-top: 2em;">Room:</h6>
    @(Html.Kendo().DropDownList()
            .Name("RoomId")
            .HtmlAttributes(new { style = "width:100%" })
            .OptionLabel("Select room...")
            .DataTextField("RoomName")
            .DataValueField("Id")           
            .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action("GetRooms", "Reservation");
                })
                .ServerFiltering(true);
            })
            .Enable(false)
            .AutoBind(false)
    )
    <br />    
    <div class="demo-section">
        @(Html.Kendo().Upload()
            .Name("images")
            .HtmlAttributes(new { aria_label = "files" })
        )
        <p style="padding-top: 1em; text-align: right">
            <button>Submit</button>
        </p>
    </div>
</form>
 
     
    