Beispiel #1
0
        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" }));
        }
Beispiel #2
0
        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 }));
        }
Beispiel #3
0
        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 }));
        }