public IActionResult Create(ResourceRequisition resourceRequisition)
        {
            Guid   obj = Guid.NewGuid();
            string gid = obj.ToString();

            resourceRequisition.Id = gid;
            _context.ResourceRequisitions.Add(resourceRequisition);
            _context.SaveChanges();
            return(CreatedAtRoute("GetToJobs", new { id = resourceRequisition.Id }, resourceRequisition));
        }
        static async Task SendMessage(IAmazonSimpleNotificationService snsClient, ResourceRequisition resourceRequisition)
        {
            var request = new PublishRequest
            {
                TopicArn = "arn:aws:sns:ap-south-1:722160623806:Request-Requisition",
                Message  = "---------Request Requisition Details----------" +
                           "\n\n Title :" + resourceRequisition.Title +
                           "\n Skills : " + resourceRequisition.Skills +
                           "\n Stages : " + resourceRequisition.Stages
            };

            await snsClient.PublishAsync(request);
        }
        public void Put(string id, ResourceRequisition resourceRequisition)
        {
            var todo = _context.ResourceRequisitions.Find(id);

            todo.Title              = resourceRequisition.Title;
            todo.Description        = resourceRequisition.Description;
            todo.HiringManagerEmail = resourceRequisition.HiringManagerEmail;
            todo.Skills             = resourceRequisition.Skills;
            todo.Notes              = resourceRequisition.Notes;
            todo.Stages             = resourceRequisition.Stages;
            todo.PlannedDeadline    = resourceRequisition.PlannedDeadline;
            _context.ResourceRequisitions.Update(todo);
            _context.SaveChanges();
        }
        public IActionResult Create(ResourceRequisition resourceRequisition)
        {
            var credentials = new EnvironmentVariablesAWSCredentials();

            if (resourceRequisition.Id == null)
            {
                Guid   obj = Guid.NewGuid();
                string gid = obj.ToString();
                resourceRequisition.Id = gid;
            }
            _context.ResourceRequisitions.Add(resourceRequisition);
            _context.SaveChanges();
            var client = new AmazonSimpleNotificationServiceClient(credentials, RegionEndpoint.APSouth1);

            SendMessage(client, resourceRequisition).Wait();
            return(CreatedAtRoute("GetToJobs", new { id = resourceRequisition.Id }, resourceRequisition));
        }