コード例 #1
0
        public IActionResult Edit(string id)
        {
            //EditCustomerViewModel editCustomer = new EditCustomerViewModel();
            var staff = _staffRepository.Get(id);

            return(View(staff));
        }
コード例 #2
0
        public void Get_staff_by_key_returns_null_when_it_does_not_exist()
        {
            using (var context = new FIFContext(ContextOptions))
            {
                var repository = new StaffRepository(context);
                var result     = repository.Get(999).Result;

                result.ShouldBeNull();
            }
        }
コード例 #3
0
        public Staff GetStaff(int id)
        {
            Staff           staffs = new Staff();
            StaffRepository repo   = new StaffRepository();

            if (staffs != null)
            {
                staffs = ParserStaff(repo.Get(id));
            }
            return(staffs);
        }
コード例 #4
0
        /// <summary>
        /// Returns staffs
        /// </summary>
        /// <param name="request">request for getting staffs</param>
        /// <returns>returns response of the operation</returns>
        public GetStaffResponse Get(GetStaffRequest request)
        {
            //If WorkplaceID(restaurantId) exists in request, get staffs by workplaceId. Otherwise, get all staffs
            var staffEntities = request.WorkplaceID.HasValue ? _staffRepository.Get(request.WorkplaceID.Value) : _staffRepository.Get();

            return(new GetStaffResponse
            {
                Staffs = staffEntities.Select(entity => new StaffDTO {
                    ID = entity.ID, WorkPlaceID = entity.WorkplaceID
                }).ToList()
            });
        }
コード例 #5
0
        public void Get_staff_by_key_returns_staff_when_it_exists()
        {
            using (var context = new FIFContext(ContextOptions))
            {
                var repository = new StaffRepository(context);
                var result     = repository.Get(1).Result;

                result.ShouldSatisfyAllConditions(
                    () => result.StaffKey.ShouldBe(1),
                    () => result.PersonalTitlePrefix.ShouldBe("Sr."),
                    () => result.FirstName.ShouldBe("Joe"),
                    () => result.MiddleName.ShouldBe("J."),
                    () => result.LastSurname.ShouldBe("Doe"),
                    () => result.StaffUniqueId.ShouldBe("1"));
            }
        }
コード例 #6
0
 //GET api/staff/3
 public Person Get(int id)
 {
     return(db.Get(id));
 }
コード例 #7
0
 public Staff Get(Staff staff)
 {
     return(staffRepository.Get(staff));
 }