public async Task <IActionResult> Put(int id, [FromBody] AnnouncementSaveDto value)
        {
            if (ModelState.IsValid)
            {
                var response = await _announcementService.EditAnnouncement(id, value);

                if (response.IsSuccessful)
                {
                    return(Ok());
                }
                else if (response.IsClientError)
                {
                    if (response.Payload != null)
                    {
                        return(Ok());
                    }
                    return(BadRequest("Resource doesnt exists!"));
                }
                else
                {
                    return(StatusCode(500, response.Message));
                }
            }
            else
            {
                return(BadRequest(String.Join(" ,", OtherServices.ReturnAllModelErrors(ModelState))));
            }
        }
Esempio n. 2
0
        public void SetOtherServices()
        {
            if (OtherServices.Length == 0)
            {
                return;
            }

            if (OtherServices.Any(p => p == "Restock"))
            {
                Restock = true;
            }
            if (OtherServices.Any(p => p == "Refuel"))
            {
                Refuel = true;
            }
            if (OtherServices.Any(p => p == "Repair"))
            {
                Repair = true;
            }
            if (OtherServices.Any(p => p == "Contacts"))
            {
                Contacts = true;
            }
            if (OtherServices.Any(p => p == "Universal Cartographics"))
            {
                UniversalCartographics = true;
            }
            if (OtherServices.Any(p => p == "Missions"))
            {
                Missions = true;
            }
            if (OtherServices.Any(p => p == "Crew Lounge"))
            {
                CrewLounge = true;
            }
            if (OtherServices.Any(p => p == "Tuning"))
            {
                Tuning = true;
            }
            if (OtherServices.Any(p => p == "Search and Rescue"))
            {
                SearchandRescue = true;
            }
            if (OtherServices.Any(p => p == "Black Market"))
            {
                BlackMarket = true;
            }
            if (OtherServices.Any(p => p == "Interstellar Factors Contact"))
            {
                InterstellarFactorsContact = true;
            }
            if (OtherServices.Any(p => p == "Material Trader"))
            {
                MaterialTrader = true;
            }
            if (OtherServices.Any(p => p == "TechnologyBroker"))
            {
                TechnologyBroker = true;
            }
        }
Esempio n. 3
0
        public List <OtherServices> GetOtherServices(int medicalId)
        {
            Query   = "SELECT Id, ServiceName FROM OtherMedicalServices WHERE MedicalId = @medicalId ORDER BY ServiceName";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.AddWithValue("medicalId", medicalId);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <OtherServices> otherServices = new List <OtherServices>();

            while (Reader.Read())
            {
                OtherServices otherService = new OtherServices();
                otherService.Id          = Convert.ToInt32(Reader["Id"]);
                otherService.ServiceName = Reader["ServiceName"].ToString();
                otherServices.Add(otherService);
            }
            Reader.Close();
            Connection.Close();
            return(otherServices);
        }
        public async Task <IActionResult> Post([FromBody] AnnouncementSaveDto value)
        {
            if (ModelState.IsValid)
            {
                var currentName = User.Identity.Name;
                var response    = await _announcementService.CreateAnnouncement(value, currentName);

                if (response.IsSuccessful)
                {
                    return(Ok());
                }
                else
                {
                    return(StatusCode(500, response.Message));
                }
            }
            else
            {
                return(BadRequest(String.Join(" ,", OtherServices.ReturnAllModelErrors(ModelState))));
            }
        }
        public async Task <IActionResult> Put(int id, AdvertisementSaveDto ad)
        {
            if (ModelState.IsValid)
            {
                var currentId = await GetCurrentUserId();

                var result = await _advertisementService.EditAdvertisement(currentId, id, ad);

                if (result.IsSuccessful)
                {
                    return(Ok());
                }

                if (result.IsClientError)
                {
                    return(BadRequest(result.Message));
                }

                return(StatusCode(500));
            }
            return(BadRequest(OtherServices.ReturnAllModelErrors(ModelState)));
        }
Esempio n. 6
0
        public List <string> GetSports()
        {
            OtherServices service = new OtherServices(services);

            return(service.GetSports());
        }