Ejemplo n.º 1
0
        public static void Insert()
        {
            customerService.CreateCustomer("Kim Jong Un", "*****@*****.**", 1);
            customerService.CreateCustomer("Volk", "*****@*****.**", 2);

            developerService.CreateDeveloper("Bandit", "Admin");
            developerService.CreateDeveloper("Tyler", "The Creator");

            developerTrackerService.CreateDeveloperTracker(1, 2);
            developerTrackerService.CreateDeveloperTracker(1, 2);

            projectService.CreateProject("Bonk");
            projectService.CreateProject("Den sna");

            timingService.CreateTiming(DateTime.Parse("08.08.2008"), DateTime.Parse("08.08.2009"), 1);
            timingService.CreateTiming(DateTime.Parse("02.02.2020"), DateTime.Parse("11.11.2020"), 2);

            trackerService.CreateTracker("Paid", "Create database", 1);
            trackerService.CreateTracker("Closed", "Write", 2);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Tracker?> > Create(CreateTrackerRequest request)
        {
            try
            {
                Tracker tracker = await TrackerService
                                  .CreateTracker(request.ChannelId, request.GameId)
                                  .ConfigureAwait(false);

                return(Created($"api/trackers/{tracker.Id}", tracker));
            }
            catch (InvalidOperationException ex)
            {
                return(Problem(ex.Message, statusCode: (int)HttpStatusCode.Conflict));
            }
            catch (ArgumentException ex)
            {
                return(Problem(ex.Message, statusCode: (int)HttpStatusCode.BadRequest));
            }
        }