예제 #1
0
        public void Create(PlaceVm vm)
        {
            Place place = new Place();

            place.Name        = vm.Name;
            place.CostPerHour = vm.CostPerHour;
            place.Address     = vm.Address;
            place.PlaceTypeId = vm.PlaceTypeId;
            PlaceDb.Create(place);
        }
예제 #2
0
        public void Edit(PlaceVm vm)
        {
            Place place = new Place();

            place.Id          = vm.Id;
            place.Name        = vm.Name;
            place.CostPerHour = vm.CostPerHour;
            place.Address     = vm.Address;
            place.PlaceTypeId = vm.PlaceTypeId;
            PlaceDb.Edit(place);
        }
예제 #3
0
        // GET: Place/Edit/5
        public ActionResult Edit(int id)
        {
            var     row = PlaceDb.GetPlaceById(id).Rows[0];
            PlaceVm vm  = new PlaceVm();

            vm.Id          = id;
            vm.Name        = row["Name"].ToString();
            vm.Address     = row["Address"].ToString();
            vm.CostPerHour = (decimal)row["CostPerHour"];
            vm.PlaceTypeId = (int)row["PlaceTypeId"];
            vm.PlaceTypes  = GetAllPlaceTypes();
            return(View(vm));
        }
예제 #4
0
        public List <ViewPlaceVm> GetAllPlaces()
        {
            var db     = PlaceDb.GetAllPlaces();
            var places = new List <ViewPlaceVm>();

            foreach (DataRow row in db.Rows)
            {
                var vm = new ViewPlaceVm();
                vm.Id          = (int)row["Id"];
                vm.Name        = (string)row["Name"];
                vm.CostPerHour = (decimal)row["CostPerHour"];
                vm.PlaceType   = (string)row["PlaceType"];
                vm.Address     = (string)row["Address"];
                places.Add(vm);
            }
            return(places);
        }
예제 #5
0
 public void Delete(int id)
 {
     PlaceDb.Delete(id);
 }