コード例 #1
0
 public async Task UpdateProject(Project model)
 {
     try
     {
         Db.Set <Project>().Update(model);
         await Db.SaveChangesAsync();
     }
     catch (Exception ex)
     {
         throw new Exception("Error: ", ex);
     }
 }
コード例 #2
0
        public async Task <bool> UpdateProject(Project project)
        {
            var currentProject = await this.FindProjectById(project.Id);

            if (currentProject == null)
            {
                return(false);
            }

            _context.Entry(currentProject).CurrentValues.SetValues(project);

            return(await _context.SaveChangesAsync() > 0);
        }
コード例 #3
0
ファイル: CourseService.cs プロジェクト: vinedsnunes/Streamer
        public async Task CreateCourse(Course model)
        {
            try
            {
                await Db.Set <Course>().AddAsync(model);

                await Db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw new Exception("Error: ", ex);
            }
        }