public async Task PutFramework(Guid id, FrameworkInputModel inputModel, string currentUsername)
        {
            var framework = await _applicationDbContext.Frameworks.FindAsync(id);

            framework.Name         = inputModel.Name;
            framework.Description  = inputModel.Description;
            framework.ModifiedBy   = currentUsername;
            framework.ModifiedDate = DateTime.Now;

            await _applicationDbContext.SaveChangesAsync();
        }
        public async Task AddFramework(FrameworkInputModel inputModel, string currentUsername)
        {
            var framework = new Framework
            {
                Name         = inputModel.Name,
                Description  = inputModel.Description,
                IsActive     = true,
                CreatedBy    = currentUsername,
                CreatedDate  = DateTime.Now,
                ModifiedBy   = currentUsername,
                ModifiedDate = DateTime.Now
            };

            _applicationDbContext.Add(framework);
            await _applicationDbContext.SaveChangesAsync();
        }
Exemple #3
0
        public async Task <IActionResult> PutFramework(Guid id, [FromForm] FrameworkInputModel frameworkInputModel)
        {
            await _frameworkService.PutFramework(id, frameworkInputModel, currentUsername);

            return(Ok());
        }
Exemple #4
0
        public async Task <IActionResult> PostFramework([FromForm] FrameworkInputModel frameworkInputModel)
        {
            await _frameworkService.AddFramework(frameworkInputModel, currentUsername);

            return(Ok());
        }