Ejemplo n.º 1
0
        public string AddAppointment([FromBody] Models.Appointments appointments)
        {
            var status = "Adding appointment failed";

            try
            {
                var app = new EFModels.Appointments()
                {
                    Id              = appointments.Id,
                    Aptid           = appointments.Aptid,
                    Userid          = appointments.Userid,
                    Phonenumber     = appointments.Phonenumber,
                    Vendorid        = appointments.Vendorid,
                    Petid           = appointments.Petid,
                    Servicedatetime = appointments.Servicedatetime,
                    Servicefees     = appointments.Servicefees,
                    Address         = appointments.Address,
                    Message         = appointments.Message,
                    Ishomeservice   = appointments.Ishomeservice,
                    Ispaid          = appointments.Ispaid
                }
                ;

                status = _AdminFacade.AddAppointments(app);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                status = "Adding appointment failed";
                throw e;
            }
            return(status);
        }
Ejemplo n.º 2
0
        public string AddAppointment([FromBody] Models.Appointments appointments)
        {
            var status      = "Adding appointment failed";
            var emailstatus = "could not send email update";

            try
            {
                var app = new EFModels.Appointments()
                {
                    Id              = appointments.Id,
                    Aptid           = appointments.Aptid,
                    Userid          = appointments.Userid,
                    Phonenumber     = appointments.Phonenumber,
                    Category        = appointments.Category,
                    Vendorid        = appointments.Vendorid,
                    Petid           = appointments.Petid,
                    Servicedatetime = appointments.Servicedatetime,
                    Servicefees     = appointments.Servicefees,
                    Address         = appointments.Address,
                    Message         = appointments.Message,
                    Ishomeservice   = appointments.Ishomeservice,
                    Ispaid          = appointments.Ispaid
                }
                ;

                status = _UserFacade.AddAppointments(app);
                if (status == "appointment created sucessfully")
                {
                    emailstatus = _mailer.SendEmail(this.GetUser(appointments.Userid).Email, "Appointment Status | StuffyCare", "The Appointments Requested was Sucessfully Booked");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                status = "Adding appointment failed";
                throw e;
            }
            return(status);
        }