Ejemplo n.º 1
0
        public void ReceivePackageTest()
        {
            var roleAgent   = userContracts.GetAllRoles().First(x => x.RoleName == "Agent");
            var roleDoctors = userContracts.GetAllRoles().First(x => x.RoleName == "Doctor");
            var roleAdmin   = userContracts.GetAllRoles().First(x => x.RoleName == "Admin");
            var package     = packageContracts.GetAll().FirstOrDefault();

            var userAgent = userContracts.GetAll().First(x => x.RoleId == roleAgent.RoleId);

            packageContracts.ReceivePackage(package, userAgent.UserName);
            var userDoctor = userContracts.GetAll().First(x => x.RoleId == roleDoctors.RoleId);

            packageContracts.ReceivePackage(package, userDoctor.UserName);
            var userAdmin = userContracts.GetAll().First(x => x.RoleId == roleAdmin.RoleId);

            packageContracts.ReceivePackage(package, userAdmin.UserName);
        }
Ejemplo n.º 2
0
        public ActionResult ReceivePackagewithModel(PackageViewModel packageViewModel)
        {
            var package = packagesContracts.Get(packageViewModel.BarcodeId);
            // Change current loc to this loc
            //Transit state
            var id = packagesContracts.ReceivePackage(package, User.Identity.GetUserName());

            if (id > 0)
            {
                TempData["Success"] = "Received Package";
                return(RedirectToAction("ReceivePackage"));
            }
            else
            {
                TempData["Fail"] = "Failed to receive";
                return(View("ReceivePackage"));
            }
        }