コード例 #1
0
        public ActionResult Detail(Service service)
        {
            if (!ModelState.IsValid)
            {
                var model = new ServiceModel()
                {
                    Service      = service,
                    ServiceTypes = EnumCollection.GetServiceTypeEnum()
                };

                return(View(model));
            }
            var result = ServiceTypeService.Save(service);

            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                var model = new ServiceModel()
                {
                    Service      = service,
                    ServiceTypes = EnumCollection.GetServiceTypeEnum()
                };
                return(View(model));
            }

            return(RedirectToAction("List"));
        }
コード例 #2
0
        public ActionResult Delete(int id)
        {
            var result = ServiceTypeService.Delete(id);

            if (!result)
            {
                TempData["Error"] = "Something went wrong";
            }
            return(RedirectToAction("List"));
        }
コード例 #3
0
 public void ConstructorIsValid()
 {
     try
     {
         var service = new ServiceTypeService(_repository);
     }
     catch (Exception e)
     {
         Assert.Fail(e.ToString());
     }
 }
コード例 #4
0
        //
        // GET: /AdminService/
        public ActionResult List()
        {
            var model = ServiceTypeService.GetAll();

            if (TempData["Error"] != null)
            {
                ViewBag.Error = TempData["Error"];
            }

            return(View(model));
        }
コード例 #5
0
        public void Initialize()
        {
            var serviceTypes = GetFakeData();

            _dbContextMock = new DbContextMock <DatabaseContext>(DummyOptions);
            var dbSetMock = _dbContextMock.CreateDbSetMock(x => x.ServiceTypes, serviceTypes);

            var repository = new ServiceTypeRepository(_dbContextMock.Object);

            _service = new ServiceTypeService(repository);
        }
コード例 #6
0
        public ActionResult Index2(int id = -1)
        {
            if (id == -1)
            {
                id = 1;
            }

            ViewBag.ID       = id;
            ViewBag.Services = ServiceTypeService.GetAll();
            return(View());
        }
コード例 #7
0
        public ActionResult Detail(int id)
        {
            var result = ServiceTypeService.GetByID(id);
            var model  = new ServiceModel()
            {
                Service      = result.Data ?? new Service(),
                ServiceTypes = EnumCollection.GetServiceTypeEnum()
            };

            return(View(model));
        }
コード例 #8
0
        public async Task GetServiceTypeAsync_Returns_Null()
        {
            //Arrange
            var id      = 10;
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var result = await service.GetServiceTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeNull();
        }
コード例 #9
0
        public async Task GetServiceTypesAsync_Returns_ServiceTypes()
        {
            //Arrange
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var result = await service.GetServiceTypesAsync();

            //Assert
            result.Should().BeAssignableTo <IEnumerable <ServiceType> >();
            result.Should().HaveCount(2);
        }
コード例 #10
0
        public async Task GetServiceTypeAsync_Returns_ServiceType()
        {
            //Arrange
            var id      = 1;
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var result = await service.GetServiceTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeAssignableTo <ServiceType>();
            result !.Id.Should().Be(id);
            result.Type.Should().Be("Take Away");
        }
コード例 #11
0
        public static IEnumerable <SelectListItem> FillddlServiceType()
        {
            var service    = new ServiceTypeService();
            var leaveTypes = service.GetAll();
            var listitems  = leaveTypes.Select(x =>

                                               new SelectListItem
            {
                Text  = x.ServiceName,
                Value = x.Id.ToString()
            });

            return(listitems);
        }
コード例 #12
0
        public async Task DeleteServiceTypeAsync_Successfully_Deleted()
        {
            //Arrange
            var id      = 1;
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var dbServiceType = await service.GetServiceTypeAsync(d => d.Id == id);

            await service.DeleteServiceTypeAsync(dbServiceType !);

            var result = await service.GetServiceTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeNull();
        }
コード例 #13
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (DialogResult.OK == XtraMessageBox.Show("Bạn muốn xóa dịch vụ ra khỏi hệ thống ?", "Xác nhận", MessageBoxButtons.OKCancel))
     {
         bool rs = serviceType.Delete(_PartnerID);
         if (rs)
         {
             serviceType = new ServiceTypeService();
             gridDataControl.DataSource = serviceType.GetList(_TourID);
         }
         else
         {
             XtraMessageBox.Show("Không tìm thấy thông tin");
         }
     }
 }
コード例 #14
0
        public DashboardModel GetPosts2()
        {
            var model = new DashboardModel()
            {
                Labels = new List <string>(),
                Datas  = new List <int>()
            };

            var services = ServiceTypeService.GetPostCount();

            foreach (var s in services)
            {
                model.Labels.Add(s.Name);
                model.Datas.Add(s.ServiceTypeID);
            }

            return(model);
        }
コード例 #15
0
        public async Task AddServiceTypeAsync_Returns_New_ServiceType()
        {
            //Arrange
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var result = await service.AddServiceTypeAsync(new ServiceType { Type = "Buffet" });

            //Assert
            result.Should().BeAssignableTo <ServiceType>();
            result.Type.Should().Be("Buffet");

            //Act
            var stockTypes = await service.GetServiceTypesAsync();

            //Assert
            stockTypes.Should().HaveCount(3);
        }
コード例 #16
0
        public async Task UpdateServiceTypeAsync_Successfully_Updated()
        {
            //Arrange
            var id      = 1;
            var service = new ServiceTypeService(_myRestaurantContext);

            //Act
            var dbServiceType = await service.GetServiceTypeAsync(d => d.Id == id);

            dbServiceType !.Type = "Take Out";

            await service.UpdateServiceTypeAsync(dbServiceType);

            var result = await service.GetServiceTypeAsync(d => d.Id == id);

            //Assert
            result.Should().BeAssignableTo <ServiceType>();
            result !.Id.Should().Be(id);
            result.Type.Should().Be("Take Out");
        }
コード例 #17
0
        public DashboardModel GetPosts2ByCurrentUser()
        {
            var model = new DashboardModel()
            {
                Labels = new List <string>(),
                Datas  = new List <int>()
            };

            if (HttpUtil.UserProfile == null)
            {
                return(model);
            }

            var list     = PostService.GetAllByUserId(HttpUtil.UserProfile.ID);
            var services = ServiceTypeService.GetAll();

            foreach (var s in services)
            {
                model.Labels.Add(s.Name);
                model.Datas.Add(list.Count(l => l.ServiceID == s.ID));
            }

            return(model);
        }
コード例 #18
0
 public ServiceTypesController()
 {
     Service = new ServiceTypeService();
 }
コード例 #19
0
 public ServiceTypesController(ServiceTypeService service)
 {
     _service = service;
 }
コード例 #20
0
 public ServiceTypesController()
 {
     Service = new ServiceTypeService();
 }
コード例 #21
0
 private void loadData()
 {
     serviceType = new ServiceTypeService();
     gridDataControl.DataSource = serviceType.GetList(_TourID);
 }
コード例 #22
0
        public static IEnumerable<SelectListItem> FillddlServiceType()
        {
            var service = new ServiceTypeService();
            var leaveTypes = service.GetAll();
            var listitems = leaveTypes.Select(x =>

                new SelectListItem
                {
                    Text = x.ServiceName,
                    Value = x.Id.ToString()
                });
            return listitems;
        }
コード例 #23
0
ファイル: Post2Controller.cs プロジェクト: Risha09/ATP2.BDAID
 public List <Service> GetAllServices()
 {
     return(ServiceTypeService.GetAll());
 }