Пример #1
0
 public static async Task <Problem> UpdateAsync(Problem problem)
 {
     using (var problemRepository = new ProblemRepository())
     {
         return(await problemRepository.UpdateAsync(problem));
     }
 }
Пример #2
0
        public static async Task <Problem> AcceptProblem(Guid id)
        {
            using (var context = new Entities())
            {
                var problemRepository  = new ProblemRepository(context);
                var districtRepository = new DistrictRepository(context);

                var districts = await districtRepository.GetAllAsync().ConfigureAwait(false);

                var problem = await problemRepository.GetAsync(id, new[]
                {
                    nameof(Problem.Districts)
                });

                problem.UserId = Guid.Empty;
                foreach (var district in districts)
                {
                    problem.Districts.Add(district);
                }

                return(await problemRepository.UpdateAsync(problem));
            }
        }