public void Add()
        {
            var wardToAdd = new Ward
            {
                Name       = Name,
                FacilityId = SelectedFacility.FacilityId
            };

            _wardService.AddWard(wardToAdd);
            if (SelectedEmployees != null)
            {
                AddWardEmployees(wardToAdd.WardId);
            }
            _wardListViewModel.WardList.Insert(0, new WardViewModel(wardToAdd));
        }
예제 #2
0
        public async Task <IHttpActionResult> AddWard(WardModel ward)
        {
            if (ward == null)
            {
                return(BadRequest("Please provide valid inputs!"));
            }

            if (await WardService.AddWard(ward))
            {
                return(Ok("Ward Saved Successfully!"));
            }
            else
            {
                return(BadRequest("Failed to Save Ward!"));
            }
        }
        public void AddWardTest()
        {
            var serv = new WardService(new MVCHContext());

            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000001"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 2",
                FacilityId = "FAC-000001"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000002"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000003"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000004"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000005"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000006"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000007"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000008"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000009"
            });
            serv.AddWard(new Ward
            {
                Name       = "Ward 1",
                FacilityId = "FAC-000010"
            });
        }