Ejemplo n.º 1
0
 public ActionResult UpdateCustomer(int CustomerID)
 {
     Services.CustomerService CustomerService = new Services.CustomerService();
     Models.Customer          Customer        = CustomerService.GetCustomerByID(CustomerID);
     ViewBag.Customer = Customer;
     return(View());
 }
Ejemplo n.º 2
0
        public void ShouldCallDatabaseToGetAllCustomers()
        {
            var mockDatabase = new Mock <ICustomerDb>();
            var sut          = new Services.CustomerService(mockDatabase.Object);

            sut.GetAll();

            mockDatabase.Verify(db => db.GetAll(), Times.Once);
        }
Ejemplo n.º 3
0
        public void ShouldCallDatabaseToGetCustomerById()
        {
            var mockDatabase = new Mock <ICustomerDb>();
            var sut          = new Services.CustomerService(mockDatabase.Object);

            sut.GetById(It.IsAny <string>());

            mockDatabase.Verify(db => db.GetById(It.IsAny <string>()), Times.Once);
        }
Ejemplo n.º 4
0
 public CodeController(DbContext.CHISEntitiesSqlServer db
                       , Services.DrugService drugsvr
                       , Services.CustomerService cusSvr
                       , Services.DoctorService docrSvr
                       ) : base(db)
 {
     _drugSvr = drugsvr;
     _cusSvr  = cusSvr;
     _docrSvr = docrSvr;
 }
Ejemplo n.º 5
0
 public object GetService(Type serviceType)
 {
     if (serviceType == typeof(CustomerController))
     {
         var customerSvc = new Services.CustomerService();
         var controller  = new Controllers.CustomerController(customerSvc);
         return(controller);
     }
     return(null);
 }
Ejemplo n.º 6
0
 public object GetService(Type serviceType)
 {
     if (serviceType == typeof(CustomerController))
     {
         var customerSvc = new Services.CustomerService();
         var controller = new Controllers.CustomerController(customerSvc);
         return controller;
     }
     return null;
 }
Ejemplo n.º 7
0
        public void ShouldCallDatabaseToInsertCustomer()
        {
            var newCustomer  = new Models.Customer(NewCustomerEmail, NewCustomerFirstName, NewCustomerSurname, NewCustomerPassword);
            var mockDatabase = new Mock <ICustomerDb>();
            var sut          = new Services.CustomerService(mockDatabase.Object);

            sut.Add(newCustomer);

            mockDatabase.Verify(db => db.Insert(newCustomer), Times.Once);
        }
Ejemplo n.º 8
0
 public HealthorController(Services.ReservationService resSvr,
                           Services.WorkStationService stationSvr,
                           Services.DoctorService docrSvr,
                           Services.CustomerService cusSvr
                           ) //: base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _docrSvr    = docrSvr;
 }
Ejemplo n.º 9
0
 public HealthorController(DbContext.CHISEntitiesSqlServer db,
                           Services.ReservationService resSvr,
                           Services.WorkStationService stationSvr,
                           Services.DoctorService docrSvr,
                           Services.CustomerService cusSvr
                           ) : base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _docrSvr    = docrSvr;
 }
Ejemplo n.º 10
0
        public void ShouldReturnCustomerWithTheSameEmailPassedIntoIt()
        {
            var newCustomer  = new Models.Customer(NewCustomerEmail, NewCustomerFirstName, NewCustomerSurname, NewCustomerPassword);
            var mockDatabase = new Mock <ICustomerDb>();

            mockDatabase.Setup(db => db.Insert(newCustomer)).ReturnsAsync(newCustomer);
            var sut = new Services.CustomerService(mockDatabase.Object);

            var actualNewCustomer = sut.Add(newCustomer).Result;

            Assert.Equal(NewCustomerEmail, actualNewCustomer.Email);
        }
Ejemplo n.º 11
0
 public JsonResult DoInsertCustomer(Models.Customer Customer)
 {
     try
     {
         Services.CustomerService CustomerService = new Services.CustomerService();
         JsonResult result = this.Json(CustomerService.InsertCustomer(Customer), JsonRequestBehavior.AllowGet);
         return(result);
     }
     catch (Exception)
     {
         return(this.Json(false));
     }
 }
Ejemplo n.º 12
0
 public JsonResult Read(Models.CustomerSearch Arg)
 {
     try
     {
         Services.CustomerService CustomerService = new Services.CustomerService();
         JsonResult result = this.Json(CustomerService.GetCustomer(Arg), JsonRequestBehavior.AllowGet);
         return(result);
     }
     catch (Exception)
     {
         return(this.Json(false));
     }
 }
Ejemplo n.º 13
0
 public JsonResult GetContactTitle()
 {
     try
     {
         Services.CustomerService CustomerService = new Services.CustomerService();
         JsonResult result = this.Json(CustomerService.GetContactTitle(), JsonRequestBehavior.AllowGet);
         return(result);
     }
     catch (Exception)
     {
         return(this.Json(false));
     }
 }
Ejemplo n.º 14
0
 public HealthorInfo(DbContext.CHISEntitiesSqlServer db,
                     Services.ReservationService resSvr,
                     Services.WorkStationService stationSvr,
                     Services.DoctorService docrSvr,
                     Services.CustomerService cusSvr,
                     Services.DispensingService dispSvr
                     ) : base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _dispSvr    = dispSvr;
 }
Ejemplo n.º 15
0
 public ReservateController(Services.ReservationService resSvr
                            , Services.WorkStationService stationSvr
                            , Services.DoctorService docrSvr
                            , Services.CustomerService cusSvr
                            , Services.WeChatService wechatSvr
                            ) //: base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _docrSvr    = docrSvr;
     _weChatSvr  = wechatSvr;
 }
Ejemplo n.º 16
0
 public NurseController(DbContext.CHISEntitiesSqlServer db
                        , Services.CustomerService cusSvr
                        , Services.WorkStationService staSvr
                        , Services.DoctorService docSvr
                        , Services.LoginService loginSvr
                        , Services.RxService rxSvr
                        ) : base(db)
 {
     _cusSvr   = cusSvr;
     _staSvr   = staSvr;
     _docSvr   = docSvr;
     _loginSvr = loginSvr;
     _rxSvr    = rxSvr;
 }
Ejemplo n.º 17
0
 public StationController(Services.ReservationService resSvr,
                          Services.WorkStationService stationSvr,
                          Services.DoctorService docrSvr,
                          Services.CustomerService cusSvr,
                          Services.DrugService drugSvr,
                          Services.DictService dicSvr
                          ) //: base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _docrSvr    = docrSvr;
     _drugSvr    = drugSvr;
     _dicSvr     = dicSvr;
 }
Ejemplo n.º 18
0
        public void ShouldReturnTheSameCustomerWithTheSameEmail()
        {
            const string newCustomerEmail     = "*****@*****.**";
            const string newCustomerFirstName = "John";
            const string newCustomerSurname   = "Clarkin";
            const string newCustomerPassword  = "******";
            var          existingCustomer     = new Models.Customer(newCustomerEmail, newCustomerFirstName, newCustomerSurname, newCustomerPassword);
            var          mockDatabase         = new Mock <ICustomerDb>();

            mockDatabase.Setup(db => db.GetById(It.IsAny <string>())).ReturnsAsync(existingCustomer);
            var sut = new Services.CustomerService(mockDatabase.Object);

            var actualNewCustomer = sut.GetById(It.IsAny <string>()).Result;

            Assert.Equal(newCustomerEmail, actualNewCustomer.Email);
        }
Ejemplo n.º 19
0
 public DispensingController(Services.ReservationService resSvr,
                             Services.WorkStationService stationSvr,
                             Services.DoctorService docrSvr,
                             Services.CustomerService cusSvr,
                             Services.DrugService drugSvr,
                             Services.DictService dicSvr
                             , Services.DispensingService dispSvr
                             , IMapper mapper
                             ) //: base(db)
 {
     _resSvr     = resSvr;
     _stationSvr = stationSvr;
     _cusSvr     = cusSvr;
     _docrSvr    = docrSvr;
     _drugSvr    = drugSvr;
     _dicSvr     = dicSvr;
     _dispSvr    = dispSvr;
     _mapper     = mapper;
 }
Ejemplo n.º 20
0
 public JsonResult DeleteCustomer(string CustomerID)
 {
     try
     {
         Services.CustomerService CustomerService = new Services.CustomerService();
         int result = CustomerService.DeleteCustomerByID(CustomerID);
         if (result >= 1)
         {
             return(this.Json(true));
         }
         else
         {
             return(this.Json(false));
         }
     }
     catch (Exception)
     {
         return(this.Json(false));
     }
 }
Ejemplo n.º 21
0
 public Customer(DbContext.CHISEntitiesSqlServer db, Services.CustomerService cusSvr, Services.FollowListService followListService) : base(db)
 {
     _cusSvr = cusSvr; _followListService = followListService;
 }
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public CustomerController()
 {
     this._service = new Services.CustomerService();
 }
Ejemplo n.º 23
0
 public CustomersController(Services.CustomerService customerService)
 {
     _customerService = customerService;
 }
Ejemplo n.º 24
0
 public CustomerController()
 {
     _customerService = new Services.CustomerService(KioskoController.GetCustomerService());
 }