Example #1
0
        public async Task <BuildingInstruction> UpdateBuildingInstruction(BuildingInstruction updateBuildingInstruction)
        {
            var updateInstruction = _appDbContext.BuildingInstructions.FirstOrDefault(x => x.BuildingInstructionId == updateBuildingInstruction.BuildingInstructionId);


            if (updateInstruction != null)
            {
                updateInstruction.ImageUrl          = updateBuildingInstruction.ImageUrl;
                updateInstruction.LongDescription   = updateBuildingInstruction.LongDescription;
                updateInstruction.Name              = updateBuildingInstruction.Name;
                updateInstruction.Pages             = updateBuildingInstruction.Pages;
                updateInstruction.PdfInstructionUrl = updateBuildingInstruction.PdfInstructionUrl;
                updateInstruction.Set        = updateBuildingInstruction.Set;
                updateInstruction.VideoUrl   = updateBuildingInstruction.VideoUrl;
                updateInstruction.ProgramUrl = updateBuildingInstruction.ProgramUrl;
                updateInstruction.CategoryId = updateBuildingInstruction.CategoryId;


                await _appDbContext.SaveChangesAsync();
            }

            return(updateInstruction);
        }
Example #2
0
 public void DeleteInstruction(BuildingInstruction deleteInstruction)
 {
     _appDbContext.BuildingInstructions.Remove(deleteInstruction);
     _appDbContext.SaveChanges();
 }
Example #3
0
        public async Task AddNewBuildingInstructionAsync(BuildingInstruction newBuildingInstruction)
        {
            await _appDbContext.BuildingInstructions.AddAsync(newBuildingInstruction);

            await _appDbContext.SaveChangesAsync();
        }