Example #1
0
        public async Task Create(StudyLoad model)
        {
            try
            {
                _logger.LogInformation("Trying to execute sql create study load query");
                model.Id = await QueryFirstAsync <int>(@"
                        insert into StudyLoad (
                            GroupDisciplineLoadId,
                            ShownValue,
                            Value,
                            ProjectType
                        ) values (
                            @GroupDisciplineLoadId,
                            @ShownValue,
                            @Value,
                            @ProjectType                           
                        );
                        select SCOPE_IDENTITY();
                ", model);

                _logger.LogInformation("Sql create study load query successfully executed");
            }
            catch (Exception exception)
            {
                _logger.LogError(exception.Message);
                throw exception;
            }
        }
Example #2
0
        public async Task <StudyLoad> Update(StudyLoad model)
        {
            await _studyLoadDao.Update(model);

            await UpdateUserLoad(model.Id, model.UsersLoad);

            return(model);
        }
Example #3
0
        public async Task Update(StudyLoad model)
        {
            try
            {
                _logger.LogInformation("Trying to execute sql update study load query");
                await ExecuteAsync(@"
                    update StudyLoad set
                        GroupDisciplineLoadId = @GroupDisciplineLoadId,
                        ShownValue = @ShownValue,
                        Value = @Value,
                        ProjectType = @ProjectType
                    from StudyLoad
                    where Id = @Id
                ", model);

                _logger.LogInformation("Sql update study load query successfully executed");
            }
            catch (Exception exception)
            {
                _logger.LogError(exception.Message);
                throw exception;
            }
        }