Ejemplo n.º 1
0
        public String deactivate()
        {
            String idParam = Request.Params["id"];
            int id = int.Parse(idParam);
            IRepository<NetCafe> repository = new NetCafeRepository();
            NetCafe deactivateNet = repository.findById(id);
            if (deactivateNet == null)
            {
                return "false";
            }
            if (deactivateNet.NetCafeStatus == SLIM_CONFIG.NETCAFE_ACTIVE)
            {
                deactivateNet.NetCafeStatus = SLIM_CONFIG.NETCAFE_DEACTIVE;
            }
            repository.Update(deactivateNet);

            return "true";
        }
Ejemplo n.º 2
0
        public String editNetCafe()
        {
            String idParam = Request.Params["id"];
            String name = Request.Params["name"];
            String address = Request.Params["address"];
            String supervisor = Request.Params["supervisor"];
            String status = Request.Params["status"];
            String phoneNumber = Request.Params["phoneNumber"];
            String description = Request.Params["description"];

            IRepository<NetCafe> repository = new NetCafeRepository();
            int id = int.Parse(idParam);
            NetCafe netcafe = repository.findById(id);
            netcafe.NetCafeName = name;
            netcafe.NetCafeAddress = address;
            netcafe.SupervisorID = int.Parse(supervisor);
            netcafe.NetCafeStatus = int.Parse(status);

            netcafe.NetCafePhoneNumber = phoneNumber;
            netcafe.NetCafeDescriptions = description;

            // kiem tra xem noi dung edit co hop le hay khong
            NetCafeService netcafeService = new NetCafeService();
            if (!netcafeService.checkValidEdition(netcafe))
            {
                return "false";
            }

            repository.Update(netcafe);
            return "true";
        }