public IActionResult Edit(string id) { //EditCustomerViewModel editCustomer = new EditCustomerViewModel(); var staff = _staffRepository.Get(id); return(View(staff)); }
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(); } }
public Staff GetStaff(int id) { Staff staffs = new Staff(); StaffRepository repo = new StaffRepository(); if (staffs != null) { staffs = ParserStaff(repo.Get(id)); } return(staffs); }
/// <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() }); }
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")); } }
//GET api/staff/3 public Person Get(int id) { return(db.Get(id)); }
public Staff Get(Staff staff) { return(staffRepository.Get(staff)); }