Ejemplo n.º 1
0
        public ActionResult _EditPort(Guid portId)
        {
            var port = _portRepository.GetPort(portId);

            PortViewModel convertedModel = new PortConverter().ConvertToView(port);

            return(PartialView(convertedModel));
        }
Ejemplo n.º 2
0
        public JsonResult GetInactivePorts()
        {
            var model = new PortViewModel();

            var ports = new List <PortViewModel>();

            var tempPorts = _portRepository.GetPorts().Where(x => !x.IsActive).ToList();

            if (tempPorts != null && tempPorts.Count > 0)
            {
                foreach (var tempPort in tempPorts)
                {
                    PortViewModel convertedModel = new PortConverter().ConvertToView(tempPort);

                    ports.Add(convertedModel);
                }
            }

            model.Ports = ports.OrderBy(x => x.PortName).ToList();

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult EditPort(PortViewModel model)
        {
            var operationResult = new OperationResult();

            Port port = new PortConverter().ConvertToDomain(model);

            operationResult = _portRepository.UpdatePort(port);

            if (operationResult.Success)
            {
                model.Success = true;

                var ports = new List <PortViewModel>();

                var tempPorts = _portRepository.GetPorts().Where(x => x.IsActive).ToList();

                if (tempPorts != null && tempPorts.Count > 0)
                {
                    foreach (var tempPort in tempPorts)
                    {
                        PortViewModel convertedModel = new PortConverter().ConvertToView(tempPort);

                        ports.Add(convertedModel);
                    }
                }

                model.Ports = ports.OrderBy(x => x.PortName).ToList();
            }
            else
            {
                model.Success = false;
                model.Message = operationResult.Message;
            }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }