public async Task <ActionResult> ChangeServiceStaffStatus(int staffID, bool isBlocked) { if (Session["loginUserID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; Response <ServiceStaff> responseServiceStaff = new Response <ServiceStaff>(); ServiceStaffsController serviceStaffController = new ServiceStaffsController(); responseServiceStaff = await serviceStaffController.GetServiceStaff(staffID); if (isBlocked == true) { responseServiceStaff.model.isActive = false; } else { responseServiceStaff.model.isActive = true; } responseServiceStaff = await serviceStaffController.PutServiceStaff(staffID, responseServiceStaff.model); return(Json(new { success = "Success" })); }
public async Task <ActionResult> AddServicesStaffFromModel(ServiceStaff serviceStaff) { if (Session["loginUserID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; Response <ServiceStaff> responseServiceStaff = new Response <ServiceStaff>(); ServiceStaffsController serviceStaffController = new ServiceStaffsController(); string contact = serviceStaff.contactNumber; //if ( serviceStaff.contactNumber != null) //{ // string[] contactArrayPlus = contact.Split('+'); // contact = contactArrayPlus[1]; //} //string[] contactArray = contact.Split('-'); //contact = contactArrayPlus[0] + contactArrayPlus[1]; serviceStaff.contactNumber = contact; serviceStaff.isActive = true; serviceStaff.communityServiceID = serviceID; serviceStaff.communityID = Convert.ToInt32(Session["loginCommunityID"].ToString()); responseServiceStaff = await serviceStaffController.PostServiceStaff(serviceStaff); //return to action with parameter return(RedirectToAction("ServiceStaff", new { serviceName = selectedServiceName })); }
public async Task <ActionResult> ServiceStaff(string serviceName) { serviceID = Convert.ToInt32(serviceName); selectedServiceName = serviceName; if (Session["loginUserID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; //ServicesController serviceController = new ServicesController(); //Response<Service> responceService = new Response<Service>(); //responceService = await serviceController.GetServicebyName(serviceName); Response <CommunityService> responceCommunityService = new Response <CommunityService>(); CommunityServicesController communityServicesController = new CommunityServicesController(); responceCommunityService = await communityServicesController.GetCommunityService(serviceID); Response <List <ServiceStaff> > responceServiceStaff = new Response <List <ServiceStaff> >(); ServiceStaffsController serviceStaffController = new ServiceStaffsController(); responceServiceStaff = await serviceStaffController.GetServiceStaffbyService(serviceID, Convert.ToInt32(Session["loginCommunityID"].ToString())); ServiceStaffDTO serviceStaffDTO = new ServiceStaffDTO(); serviceStaffDTO.serviceStaffList = responceServiceStaff.model; serviceStaffDTO.serviceName = responceCommunityService.model.serviceName; serviceID = responceCommunityService.model.communityServiceID; return(View(serviceStaffDTO)); }
public async Task <ActionResult> DeleteServicesStaffwithMemberID(int StaffMemberID) { if (Session["loginUserID"] == null || Session["loginCommunityID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; Response <ServiceStaff> responseServiceStaff = new Response <ServiceStaff>(); ServiceStaffsController serviceStaffController = new ServiceStaffsController(); responseServiceStaff = await serviceStaffController.DeleteServiceStaff(StaffMemberID); responseServiceStaff = null; return(Json(new { Success = "sucess" })); }
public async Task <ActionResult> EditServicesStaff(FormCollection data) { if (Session["loginUserID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; ServiceStaff serviceStaff = new ServiceStaff(); serviceStaff.id = Convert.ToInt32(data["id"].ToString()); ServiceStaffsController serviceStaffsController = new ServiceStaffsController(); Response <ServiceStaff> responseServiceStaff = new Response <ServiceStaff>(); responseServiceStaff = await serviceStaffsController.GetServiceStaff(serviceStaff.id); serviceStaff = responseServiceStaff.model; serviceStaff.communityServiceID = Convert.ToInt32(data["communityServiceID"].ToString()); serviceStaff.name = data["Name"].ToString(); serviceStaff.staffRole = data["Designation"].ToString(); serviceStaff.contactNumber = data["Contact"].ToString(); serviceStaff.emailID = data["EmailID"].ToString(); serviceStaff.communityID = Convert.ToInt32(Session["loginCommunityID"].ToString()); if (Request.Files["Featurefile"] != null) { var postedFile = Request.Files["staffImage"]; if (postedFile.ContentLength != 0) { imageForBlob imageForBlob = new imageForBlob(); string blobImageURL = imageForBlob.ConvertImageForBlob(); serviceStaff.image = blobImageURL; } } responseServiceStaff = await serviceStaffsController.PutServiceStaff(serviceStaff.id, serviceStaff); //return to action with parameter return(Json(new { ResponseServiceStaff = responseServiceStaff.model })); }
public async Task <Response <List <ServiceNameWithStaffDTO> > > GetServicebyCommunityID(int communityID, int DummyService) { Response <List <ServiceNameWithStaffDTO> > responceServiceNameWithStaffDTO = new Response <List <ServiceNameWithStaffDTO> >(); List <Service> serviceList = new List <Service>(); List <ServiceNameWithStaffDTO> serviceNameWithStaffDTOList = new List <ServiceNameWithStaffDTO>(); Service service = new Service(); List <CommunityService> communityServiceList = new List <CommunityService>(); communityServiceList = (from l in db.CommunityServices where l.communityID == communityID select l).ToList(); foreach (var item in communityServiceList) { ServiceNameWithStaffDTO serviceNameWithStaffDTO = new ServiceNameWithStaffDTO(); serviceNameWithStaffDTO.service = await(db.CommunityServices.Where(x => x.communityServiceID == item.communityServiceID)).FirstOrDefaultAsync(); ServiceStaffsController serviceStaffsController = new ServiceStaffsController(); Response <List <ServiceStaff> > responseServiceStaff = new Response <List <ServiceStaff> >(); responseServiceStaff = await serviceStaffsController.GetServiceStaffbyService(serviceNameWithStaffDTO.service.communityServiceID, communityID); serviceNameWithStaffDTO.serviceStaff = responseServiceStaff.model; serviceNameWithStaffDTOList.Add(serviceNameWithStaffDTO); } if (communityServiceList == null) { responceServiceNameWithStaffDTO.status = "Failed: No Community Service"; responceServiceNameWithStaffDTO.model = null; return(responceServiceNameWithStaffDTO); } foreach (var item in communityServiceList) { service = await(from l in db.Services where l.serviceID == item.communityServiceID select l).FirstOrDefaultAsync(); serviceList.Add(service); } responceServiceNameWithStaffDTO.status = "Success"; responceServiceNameWithStaffDTO.model = serviceNameWithStaffDTOList; return(responceServiceNameWithStaffDTO); }
public async Task <ActionResult> EditServicesStaffFromModel(ServiceStaff serviceStaff) { if (Session["loginUserID"] == null) { TempData["error"] = "Null"; return(RedirectToAction("Index", "Home")); } Session.Timeout = 1000; string contact = serviceStaff.contactNumber; //if (serviceStaff.contactNumber != null) //{ // string[] contactArrayPlus = contact.Split('+'); // contact = contactArrayPlus[1]; //} //string[] contactArray = contact.Split('-'); //contact = contactArrayPlus[0] + contactArrayPlus[1]; Response <ServiceStaff> responseServiceStaff = new Response <ServiceStaff>(); ServiceStaffsController serviceStaffController = new ServiceStaffsController(); responseServiceStaff = await serviceStaffController.GetServiceStaff(serviceStaff.id); //responseServiceStaff =await serviceStaffController.GetServiceStaff(serviceStaff.id); responseServiceStaff.model.contactNumber = contact; var httpRequest = System.Web.HttpContext.Current.Request; if (httpRequest.Files.Count > 0) { var docfiles = new List <string>(); foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; if (postedFile.ContentLength != 0) { imageForBlob imageForBlob = new imageForBlob(); string blobImageURL = imageForBlob.ConvertImageForBlob(); serviceStaff.image = blobImageURL; } else { responseServiceStaff = await serviceStaffController.GetServiceStaff(serviceStaff.id); serviceStaff.image = responseServiceStaff.model.image; } } } else { responseServiceStaff = await serviceStaffController.GetServiceStaff(serviceStaff.id); serviceStaff.image = responseServiceStaff.model.image; } serviceStaff.communityServiceID = serviceID; serviceStaff.communityID = Convert.ToInt32(Session["loginCommunityID"].ToString()); responseServiceStaff.model.image = serviceStaff.image; responseServiceStaff.model.name = serviceStaff.name; responseServiceStaff.model.staffRole = serviceStaff.staffRole; responseServiceStaff.model.isActive = serviceStaff.isActive; responseServiceStaff.model.emailID = serviceStaff.emailID; responseServiceStaff = await serviceStaffController.PutServiceStaff(serviceStaff.id, responseServiceStaff.model); //return to action with parameter return(RedirectToAction("ServiceStaff", new { serviceName = selectedServiceName })); }