public int AddTestimonial(TestimonialsModel objTestimonial, HttpPostedFileBase file) { if (file != null) { MemoryStream target = new MemoryStream(); file.InputStream.CopyTo(target); objTestimonial.PatientImage = target.ToArray(); } objTestimonial.CreatedDate = DateTime.Now.Date; objTestimonial.UpdatedDate = DateTime.Now.Date; objTestimonial.IsActive = true; using (PhysioDevEntities db = new PhysioDevEntities()) { try { Testimonial testimonial = new Testimonial(); objTestimonial.CopyProperties(testimonial); db.Testimonials.Add(testimonial); return(db.SaveChanges()); } catch (Exception ex) { return(0); throw ex; } } }
public int AddEmployee(EmployeeModel employee, HttpPostedFileBase file) { if (file != null) { MemoryStream ms = new MemoryStream(); file.InputStream.CopyTo(ms); employee.Image = ms.ToArray(); } employee.CreatedDate = DateTime.Now.Date; employee.UpdatedDate = DateTime.Now.Date; employee.IsActive = true; using (PhysioDevEntities db = new PhysioDevEntities()) { try { Employee emp = new Employee(); employee.CopyProperties(emp); db.Employees.Add(emp); db.SaveChanges(); return(1); } catch (Exception) { return(0); } } }
public int AddService(ServicesModel objSerive, HttpPostedFileBase file) { if (file != null) { MemoryStream target = new MemoryStream(); file.InputStream.CopyTo(target); objSerive.Image = target.ToArray(); } objSerive.CreatedDate = DateTime.Now.Date; objSerive.UpdatedDate = DateTime.Now.Date; objSerive.IsActive = true; using (PhysioDevEntities db = new PhysioDevEntities()) { try { Service service = new Service(); objSerive.CopyProperties(service); db.Services.Add(service); db.SaveChanges(); return(1); } catch (DbEntityValidationException ex) { return(0); throw ex; } } }
public int CreateHistory(HistoryModel history) { //History objHistory = new History(); history.IsActive = true; history.CreatedDate = DateTime.Now.Date; history.UpdatedDate = DateTime.Now.Date; using (PhysioDevEntities db = new PhysioDevEntities()) { try { History obj = new History(); history.CopyProperties(obj); db.Histories.Add(obj); db.SaveChanges(); return(1); } catch (Exception ex) { return(0); throw ex; } } }
public int AddAbout(AboutClinicModel objAbout, HttpPostedFileBase file) { if (file != null) { MemoryStream target = new MemoryStream(); file.InputStream.CopyTo(target); objAbout.Image = target.ToArray(); } objAbout.CreatedDate = DateTime.Now.Date; objAbout.UpdatedDate = DateTime.Now.Date; objAbout.IsActive = true; using (PhysioDevEntities db = new PhysioDevEntities()) { try { AboutClinic obj = new AboutClinic(); objAbout.CopyProperties(obj); db.AboutClinics.Add(obj); db.SaveChanges(); return(1); } catch (DbEntityValidationException ex) { return(0); throw ex; } } }
public void RemoveEmoployee(long empId) { using (PhysioDevEntities db = new PhysioDevEntities()) { var emp = db.Employees.Where(m => m.EmpId == empId).FirstOrDefault(); emp.IsActive = false; db.SaveChanges(); } }
public void DeleteHistory(long historyId) { using (PhysioDevEntities db = new PhysioDevEntities()) { var history = db.Histories.Where(m => m.HistoryId == historyId).FirstOrDefault(); history.IsActive = false; history.UpdatedDate = DateTime.Now.Date; db.SaveChanges(); } }
public void DeleteTestimonial(int Id) { using (PhysioDevEntities db = new PhysioDevEntities()) { var testimonial = db.Testimonials.Where(m => m.Id == Id).FirstOrDefault(); testimonial.IsActive = false; testimonial.UpdatedDate = DateTime.Now.Date; db.SaveChanges(); } }
public void DeleteAbout(long AboutId) { using (PhysioDevEntities db = new PhysioDevEntities()) { var objAbout = db.AboutClinics.Where(m => m.Id == AboutId).FirstOrDefault(); objAbout.IsActive = false; objAbout.UpdatedDate = DateTime.Now.Date; db.SaveChanges(); } }
public void DeletePartialPage(long PartialPageId) { using (PhysioDevEntities db = new PhysioDevEntities()) { var partialPage = db.PartialPages.Where(m => m.PartialPageId == PartialPageId).FirstOrDefault(); partialPage.IsActive = false; partialPage.UpdatedDate = DateTime.Now.Date; db.SaveChanges(); } }
public void DeleteService(long ServiceId) { using (PhysioDevEntities db = new PhysioDevEntities()) { var service = db.Services.Where(m => m.ServiceId == ServiceId).FirstOrDefault(); service.IsActive = false; service.UpdatedDate = DateTime.Now.Date; db.SaveChanges(); } }
public EmployeeModel GetEmployee(long?empId) { EmployeeModel objemp = new EmployeeModel(); using (PhysioDevEntities db = new PhysioDevEntities()) { var employee = db.Employees.Where(m => m.EmpId == empId).FirstOrDefault(); employee.CopyProperties(objemp); } return(objemp); }
public ServicesModel GetService(long?ServiceId) { ServicesModel objServicesModel = new ServicesModel(); using (PhysioDevEntities db = new PhysioDevEntities()) { var service = db.Services.Where(m => m.ServiceId == ServiceId).FirstOrDefault(); service.CopyProperties(objServicesModel); } return(objServicesModel); }
public Models.PartialPageModel GetPartialPage(long?PartialPageId) { PartialPageModel objPartialPageModel = new PartialPageModel(); if (PartialPageId != null) { using (PhysioDevEntities db = new PhysioDevEntities()) { var partialPage = db.PartialPages.Where(m => m.PartialPageId == PartialPageId).FirstOrDefault(); partialPage.CopyProperties(objPartialPageModel); } } return(objPartialPageModel); }
public Models.PartialPageModel GetPartialByPageCode(string PageCode) { PartialPageModel objPartialPageModel = new PartialPageModel(); if (!string.IsNullOrEmpty(PageCode)) { using (PhysioDevEntities db = new PhysioDevEntities()) { var partialPage = db.PartialPages.Where(m => m.PageCode == PageCode).FirstOrDefault(); partialPage.CopyProperties(objPartialPageModel); } } return(objPartialPageModel); }
public AboutClinicModel GetAbout(long?AboutId) { AboutClinicModel objAboutClinicModel = new AboutClinicModel(); if (AboutId != null) { using (PhysioDevEntities db = new PhysioDevEntities()) { var about = db.AboutClinics.Where(m => m.Id == AboutId).FirstOrDefault(); about.CopyProperties(objAboutClinicModel); } } return(objAboutClinicModel); }
public HistoryModel GetHistory(long?historyId) { HistoryModel objhistory = new HistoryModel(); if (historyId != null) { using (PhysioDevEntities db = new PhysioDevEntities()) { var Histor = db.Histories.Where(m => m.HistoryId == historyId).FirstOrDefault(); Histor.CopyProperties(objhistory); } } return(objhistory); }
public Photo GetPhoto(int?PhotoId) { Photo objPhotoModel = new Photo(); if (PhotoId != null) { using (PhysioDevEntities db = new PhysioDevEntities()) { var Photo = db.Galleries.Where(m => m.PhotoId == PhotoId).FirstOrDefault(); Photo.CopyProperties(objPhotoModel); } } return(objPhotoModel); }
public TestimonialsModel GetTestimonial(int?Id) { TestimonialsModel objTestimonialsModel = new TestimonialsModel(); if (Id != null) { using (PhysioDevEntities db = new PhysioDevEntities()) { var Testimonial = db.Testimonials.Where(m => m.Id == Id).FirstOrDefault(); Testimonial.CopyProperties(objTestimonialsModel); } } return(objTestimonialsModel); }
public List <TestimonialsModel> GetAllTestimonial() { List <TestimonialsModel> lstTestimonialModel = new List <TestimonialsModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstTestimonials = db.Testimonials.Where(m => m.IsActive == true).OrderByDescending(m => m.Id).ToList(); foreach (var testimonial in lstTestimonials) { TestimonialsModel objTestimonial = new TestimonialsModel(); testimonial.CopyProperties(objTestimonial); lstTestimonialModel.Add(objTestimonial); } } return(lstTestimonialModel); }
public List <Models.PartialPageModel> GetAllPartialPage() { List <PartialPageModel> lstPartialPageModel = new List <PartialPageModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstPartials = db.PartialPages.Where(m => m.IsActive == true).ToList(); foreach (var Partial in lstPartials) { PartialPageModel obj = new PartialPageModel(); Partial.CopyProperties(obj); lstPartialPageModel.Add(obj); } } return(lstPartialPageModel); }
public List <EmployeeModel> GetEmployees() { List <EmployeeModel> lstemp = new List <EmployeeModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstemployees = db.Employees.Where(m => m.IsActive == true).ToList(); foreach (var employee in lstemployees) { EmployeeModel objemp = new EmployeeModel(); employee.CopyProperties(objemp); lstemp.Add(objemp); } } return(lstemp); }
public List <Photo> GetAllPhoto() { List <Photo> lstPhotoModel = new List <Photo>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstPhoto = db.Galleries.Where(m => m.IsActive == true).ToList(); foreach (var photo in lstPhoto) { Photo objPhoto = new Photo(); photo.CopyProperties(objPhoto); lstPhotoModel.Add(objPhoto); } } return(lstPhotoModel); }
public List <HistoryModel> GetAllHistories() { List <HistoryModel> lstalllhistory = new List <HistoryModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lsthistories = db.Histories.Where(m => m.IsActive == true).OrderByDescending(m => m.HistoryId).ToList(); foreach (var history in lsthistories) { HistoryModel objhistory = new HistoryModel(); history.CopyProperties(objhistory); lstalllhistory.Add(objhistory); } } return(lstalllhistory); }
public List <ServicesModel> GetAllServices() { List <ServicesModel> lstServicesModel = new List <ServicesModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstServices = db.Services.Where(m => m.IsActive == true).OrderByDescending(m => m.ServiceId).ToList(); foreach (var service in lstServices) { ServicesModel objservice = new ServicesModel(); service.CopyProperties(objservice); lstServicesModel.Add(objservice); } } return(lstServicesModel); }
public List <AboutClinicModel> GetAllAbout() { List <AboutClinicModel> lstAboutClinicModel = new List <AboutClinicModel>(); using (PhysioDevEntities db = new PhysioDevEntities()) { var lstAbouts = db.AboutClinics.Where(m => m.IsActive == true).OrderByDescending(m => m.Id).ToList(); foreach (var About in lstAbouts) { AboutClinicModel objAbout = new AboutClinicModel(); About.CopyProperties(objAbout); lstAboutClinicModel.Add(objAbout); } } return(lstAboutClinicModel); }
public int AddPhoto(Photo objPhoto) { using (PhysioDevEntities db = new PhysioDevEntities()) { try { Gallery gallery = new Gallery(); objPhoto.CopyProperties(gallery); db.Galleries.Add(gallery); return(db.SaveChanges()); } catch (Exception ex) { return(0); throw ex; } } }
public int DeletePhoto(int PhotoId) { using (PhysioDevEntities db = new PhysioDevEntities()) { try { var Photo = db.Galleries.Where(m => m.PhotoId == PhotoId).FirstOrDefault(); db.Entry(Photo).State = EntityState.Deleted; //Delete forever //galleries.IsActive = false; return(db.SaveChanges()); } catch (Exception ex) { return(0); throw ex; } } }
public int UpdateAbout(AboutClinicModel objAbout) { using (PhysioDevEntities db = new PhysioDevEntities()) { objAbout.UpdatedDate = DateTime.Now.Date; try { AboutClinic objAboutClinic = new AboutClinic(); objAbout.CopyProperties(objAboutClinic); db.Entry(objAboutClinic).State = EntityState.Modified; db.SaveChanges(); return(1); } catch (Exception ex) { return(0); } } }
public int UpdatePhoto(Photo objPhoto) { using (PhysioDevEntities db = new PhysioDevEntities()) { objPhoto.CreatedOn = DateTime.Now.Date; try { Photo photo = new Photo(); objPhoto.CopyProperties(photo); db.Entry(photo).State = EntityState.Modified; return(db.SaveChanges()); } catch (Exception ex) { return(0); throw ex; } } }