public IActionResult CreateEligibility([FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            var entity = new Eligibility();

            entity.IsCitizen        = item.IsCitizen;
            entity.IsFelon          = item.IsFelon;
            entity.IsMentalIncomp   = item.IsMentalIncomp;
            entity.NewRegistration  = item.NewRegistration;
            entity.RecordUpdate     = item.RecordUpdate;
            entity.RequesttoReplace = item.RequesttoReplace;
            entity.DLNumber         = item.DLNumber;
            entity.LastSSN          = item.LastSSN;
            entity.IssueDate        = item.IssueDate;
            entity.LastName         = item.LastName;
            entity.Firstname        = item.Firstname;
            entity.MiddleName       = item.MiddleName;
            entity.Suffix           = item.Suffix;
            entity.Dob = item.Dob;
            _context.Eligibilitys.Add(entity);
            _context.SaveChanges();
            item.Id = entity.Id;
            // Debug.WriteLine(" ID is " + entity.Id);

            // return Ok(entity);

            return(Ok(entity));
        }
Beispiel #2
0
        public IActionResult CreateEligibility([FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            _context.Eligibilitys.Add(new Eligibility
            {
                IsCitizen        = item.IsCitizen,
                IsFelon          = item.IsFelon,
                IsMentalIncomp   = item.IsMentalIncomp,
                NewRegistration  = item.NewRegistration,
                RecordUpdate     = item.RecordUpdate,
                RequesttoReplace = item.RequesttoReplace,
                DLNumber         = item.DLNumber,
                LastSSN          = item.LastSSN,
                IssueDate        = item.IssueDate,
                LastName         = item.LastName,
                Firstname        = item.Firstname,
                MiddleName       = item.MiddleName,
                Suffix           = item.Suffix,
                Dob = item.Dob
            });
            _context.SaveChanges();

            return(Ok(new { message = "Eligibility is added successfully." }));
        }