示例#1
0
        static void Main(string[] args)
        {
            var     connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectToPostgreSql"].ConnectionString;
            Patient patient          = new Patient
            {
                FirstName   = "Венедикт",
                MiddleName  = "Альбертович",
                LastName    = "Слабоумов",
                CreatedDate = DateTime.Now,
                Age         = 32,
                Gender      = Gender.Male,
                Id          = 2,
                //SoftDeletedDate = DateTime.Now
            };

            patient.MiddleName = "АВДОСИЙ";
            patient.Age        = 53;
            PatientsService patientsService = new PatientsService(connectionString);

            //patientsService.Add(patient);
            //patientsService.Update(patient);
            patientsService.Delete(1);

            Console.ReadKey();
        }
示例#2
0
        public ActionResult <bool> DeletePatient(int id)
        {
            var patient = _patientsService.GetById(id).Result;

            if (patient != null)
            {
                var result = _patientsService.Delete(patient).Result;
                if (result)
                {
                    return(Ok(result));
                }
                return(BadRequest("Unable to delete record"));
            }
            return(BadRequest("No matching record was found"));
        }