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); }
public List <Models.Appointments> GetAppointments(string userid, string petid) { List <Models.Appointments> listobj = new List <Models.Appointments>(); try { var repobj = _UserFacade.GetAppointments(userid, petid); if (repobj != null) { foreach (var appointments in repobj) { var iter = new Models.Appointments { Id = appointments.Id, Aptid = appointments.Aptid, Userid = appointments.Userid, Phonenumber = appointments.Phonenumber, Vendorid = appointments.Vendorid, Category = appointments.Category, Petid = appointments.Petid, Servicedatetime = appointments.Servicedatetime, Servicefees = appointments.Servicefees, Address = appointments.Address, Message = appointments.Message, Ishomeservice = appointments.Ishomeservice, Ispaid = appointments.Ispaid }; listobj.Add(iter); } } } catch (Exception e) { Console.WriteLine(e.Message); listobj = null; throw e; } return(listobj); }
public List <Models.Appointments> GetAppointmentsByVendorid(string vendorid) { List <Models.Appointments> listobj = new List <Models.Appointments>(); try { var repobj = _VendorFacade.GetAppointmentsByVendorid(vendorid); if (repobj != null) { foreach (var service in repobj) { var iter = new Models.Appointments { Id = service.Id, Aptid = service.Aptid, Userid = service.Userid, Phonenumber = service.Phonenumber, Vendorid = service.Vendorid, Category = service.Category, Petid = service.Petid, Servicedatetime = service.Servicedatetime, Servicefees = service.Servicefees, Address = service.Address, Message = service.Message, Ishomeservice = service.Ishomeservice, Ispaid = service.Ispaid }; listobj.Add(iter); } } } catch (Exception e) { listobj = null; throw e; } return(listobj); }
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); }
public IHttpActionResult GetAppointments(string category) { List <Models.Appointments> obj = new List <Models.Appointments>(); try { var repobj = _AdminFacade.GetAppointments(category); if (repobj != null) { foreach (var appointments in repobj) { var iter = new Models.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 }; obj.Add(iter); } } } catch (Exception e) { obj = null; throw e; } return(Ok(obj)); }