示例#1
0
        public async Task <int> Updateroject(Projecttype projecttype)
        {
            var projects = await _sampleDbContext.Projecttype.Where(x => x.ProjectId.Equals(projecttype.ProjectId)).FirstOrDefaultAsync();

            _sampleDbContext.Update(projects);
            return(await _sampleDbContext.SaveChangesAsync());
        }
        public static Projecttype  AddProjectMapper(ProjectDto projectDto)
        {
            Projecttype projecttype = new Projecttype();

            projecttype.ProjectId   = Guid.NewGuid();
            projecttype.ProjectName = projectDto.ProjectName;
            projecttype.IsActive    = projectDto.IsActive;

            return(projecttype);
        }
示例#3
0
        public async Task <int> AddProject(Projecttype projecttype)
        {
            var    optionsBuilder   = new DbContextOptionsBuilder <SampleDbContext>();
            string connectionString = "User ID=abbadmin@abbrcsdatabse;Password=relcare123#;Host=abbrcsdatabse.postgres.database.azure.com;Port=5432;Database=SampleDb;Pooling=true";

            optionsBuilder.UseNpgsql(connectionString);

            using (var context = new SampleDbContext(optionsBuilder.Options))
            {
                await context.Projecttype.AddAsync(projecttype);

                return(await context.SaveChangesAsync());
            }
        }