예제 #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"));
        }
        public ActionResult PostServiceType([FromBody] ServiceTypeDto serviceTypeDto)
        {
            var response = _service.Add(serviceTypeDto);

            _service.Save(response);

            return(new OkObjectResult(response["Output"]));
        }
예제 #3
0
        public void AddServiceType()
        {
            _service.Add(new ServiceTypeDto {
                Id = "3", Name = "name3"
            });
            _service.Save(_dbContextMock);

            var result = _service.GetAll();
            var count  = result.Count();

            Assert.AreEqual(3, count);
        }